fake_application_config_manager.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef FUCHSIA_WEB_RUNNERS_CAST_FAKE_APPLICATION_CONFIG_MANAGER_H_
  5. #define FUCHSIA_WEB_RUNNERS_CAST_FAKE_APPLICATION_CONFIG_MANAGER_H_
  6. #include <map>
  7. #include <string>
  8. #include <vector>
  9. #include "fuchsia_web/runners/cast/fidl/fidl/chromium/cast/cpp/fidl.h"
  10. #include "url/gurl.h"
  11. // Test cast.ApplicationConfigManager implementation which maps a test Cast
  12. // AppId to a URL.
  13. class FakeApplicationConfigManager
  14. : public chromium::cast::ApplicationConfigManager {
  15. public:
  16. // Default agent url used for all applications.
  17. static const char kFakeAgentUrl[];
  18. FakeApplicationConfigManager();
  19. FakeApplicationConfigManager(const FakeApplicationConfigManager&) = delete;
  20. FakeApplicationConfigManager& operator=(const FakeApplicationConfigManager&) =
  21. delete;
  22. ~FakeApplicationConfigManager() override;
  23. // Creates a config for a dummy application with the specified |id| and |url|.
  24. // Callers should updated the returned config as necessary and then register
  25. // the app by calling AddAppConfig().
  26. static chromium::cast::ApplicationConfig CreateConfig(const std::string& id,
  27. const GURL& url);
  28. // Adds |app_config| to the list of apps.
  29. void AddAppConfig(chromium::cast::ApplicationConfig app_config);
  30. // Associates a Cast application |id| with the |url|.
  31. void AddApp(const std::string& id, const GURL& url);
  32. // chromium::cast::ApplicationConfigManager interface.
  33. void GetConfig(std::string id, GetConfigCallback config_callback) override;
  34. private:
  35. std::map<std::string, chromium::cast::ApplicationConfig> id_to_config_;
  36. };
  37. #endif // FUCHSIA_WEB_RUNNERS_CAST_FAKE_APPLICATION_CONFIG_MANAGER_H_