Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <memory> | |
| 6 | |
| 7 #include "chrome/browser/media/router/media_router_ui_service.h" | |
| 8 #include "chrome/browser/media/router/media_router_ui_service_factory.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | |
| 11 #include "chrome/browser/ui/toolbar/toolbar_actions_model_factory.h" | |
| 12 #include "chrome/test/base/testing_profile.h" | |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | |
| 14 #include "testing/gtest/include/gtest/gtest.h" | |
| 15 | |
| 16 namespace media_router { | |
| 17 | |
| 18 class MediaRouterUIServiceFactoryUnitTest : public testing::Test { | |
| 19 public: | |
| 20 MediaRouterUIServiceFactoryUnitTest() {} | |
| 21 ~MediaRouterUIServiceFactoryUnitTest() override {} | |
| 22 | |
| 23 void SetUp() override { | |
| 24 TestingProfile::Builder builder; | |
| 25 // MediaRouterUIService instantiates MediaRouterActionController, which | |
| 26 // requires ToolbarActionsModel. | |
| 27 builder.AddTestingFactory(ToolbarActionsModelFactory::GetInstance(), | |
| 28 BuildFakeToolBarActionsModel); | |
| 29 profile_ = builder.Build(); | |
| 30 } | |
| 31 | |
| 32 static std::unique_ptr<KeyedService> BuildFakeToolBarActionsModel( | |
| 33 content::BrowserContext* context) { | |
| 34 return std::unique_ptr<ToolbarActionsModel>(new ToolbarActionsModel( | |
| 35 static_cast<Profile*>(context), nullptr)); | |
| 36 } | |
| 37 | |
| 38 protected: | |
| 39 content::TestBrowserThreadBundle thread_bundle_; | |
| 40 Profile* profile() { return profile_.get(); } | |
| 41 | |
| 42 private: | |
| 43 std::unique_ptr<Profile> profile_; | |
| 44 }; | |
| 45 | |
| 46 TEST_F(MediaRouterUIServiceFactoryUnitTest, CreateService) { | |
| 47 MediaRouterUIService* service = | |
| 48 MediaRouterUIServiceFactory::GetForBrowserContext(profile()); | |
| 49 ASSERT_TRUE(service); | |
| 50 } | |
| 51 | |
| 52 } // namespace media_router | |
| OLD | NEW |