1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef FUCHSIA_RUNNERS_CAST_FAKE_APPLICATION_CONFIG_MANAGER_H_ 6 #define FUCHSIA_RUNNERS_CAST_FAKE_APPLICATION_CONFIG_MANAGER_H_ 7 8 #include <map> 9 #include <string> 10 #include <vector> 11 12 #include "base/macros.h" 13 #include "fuchsia/fidl/chromium/cast/cpp/fidl.h" 14 #include "url/gurl.h" 15 16 // Test cast.ApplicationConfigManager implementation which maps a test Cast 17 // AppId to a URL. 18 class FakeApplicationConfigManager 19 : public chromium::cast::ApplicationConfigManager { 20 public: 21 FakeApplicationConfigManager(); 22 ~FakeApplicationConfigManager() override; 23 24 // Creates a config for a dummy application with the specified |id| and |url|. 25 // Callers should updated the returned config as necessary and then register 26 // the app by calling AddAppConfig(). 27 static chromium::cast::ApplicationConfig CreateConfig(const std::string& id, 28 const GURL& url); 29 30 // Adds |app_config| to the list of apps. 31 void AddAppConfig(chromium::cast::ApplicationConfig app_config); 32 33 // Associates a Cast application |id| with the |url|. 34 void AddApp(const std::string& id, const GURL& url); 35 36 // chromium::cast::ApplicationConfigManager interface. 37 void GetConfig(std::string id, GetConfigCallback config_callback) override; 38 39 private: 40 std::map<std::string, chromium::cast::ApplicationConfig> id_to_config_; 41 42 DISALLOW_COPY_AND_ASSIGN(FakeApplicationConfigManager); 43 }; 44 45 #endif // FUCHSIA_RUNNERS_CAST_FAKE_APPLICATION_CONFIG_MANAGER_H_ 46