Chromium Code Reviews| Index: chrome/browser/media/router/media_router_ui_service_factory_unittest.cc |
| diff --git a/chrome/browser/media/router/media_router_ui_service_factory_unittest.cc b/chrome/browser/media/router/media_router_ui_service_factory_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..114b709f6ad7eee110692746bc9fde4c6c43e282 |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_router_ui_service_factory_unittest.cc |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
Devlin
2016/09/15 21:08:42
Does this test add any value over generic KeyedSer
takumif
2016/09/16 21:04:05
It serves as a sanity check to ensure that the ser
Devlin
2016/09/16 22:37:32
This service doesn't do anything different from ev
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <memory> |
| + |
| +#include "chrome/browser/media/router/media_router_ui_service.h" |
| +#include "chrome/browser/media/router/media_router_ui_service_factory.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| +#include "chrome/browser/ui/toolbar/toolbar_actions_model_factory.h" |
| +#include "chrome/test/base/testing_profile.h" |
| +#include "content/public/test/test_browser_thread_bundle.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace media_router { |
| + |
| +class MediaRouterUIServiceFactoryUnitTest : public testing::Test { |
| + public: |
| + MediaRouterUIServiceFactoryUnitTest() {} |
| + ~MediaRouterUIServiceFactoryUnitTest() override {} |
| + |
| + void SetUp() override { |
| + TestingProfile::Builder builder; |
| + // MediaRouterUIService instantiates MediaRouterActionController, which |
| + // requires ToolbarActionsModel. |
| + builder.AddTestingFactory(ToolbarActionsModelFactory::GetInstance(), |
| + BuildFakeToolBarActionsModel); |
| + profile_ = builder.Build(); |
| + } |
| + |
| + static std::unique_ptr<KeyedService> BuildFakeToolBarActionsModel( |
| + content::BrowserContext* context) { |
| + return std::unique_ptr<ToolbarActionsModel>(new ToolbarActionsModel( |
| + static_cast<Profile*>(context), nullptr)); |
| + } |
| + |
| + protected: |
| + content::TestBrowserThreadBundle thread_bundle_; |
| + Profile* profile() { return profile_.get(); } |
| + |
| + private: |
| + std::unique_ptr<Profile> profile_; |
| +}; |
| + |
| +TEST_F(MediaRouterUIServiceFactoryUnitTest, CreateService) { |
| + MediaRouterUIService* service = |
| + MediaRouterUIServiceFactory::GetForBrowserContext(profile()); |
| + ASSERT_TRUE(service); |
| +} |
| + |
| +} // namespace media_router |