| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/media/router/media_router_factory.h" | 8 #include "chrome/browser/media/router/media_router_factory.h" |
| 9 #include "chrome/browser/media/router/mock_media_router.h" | 9 #include "chrome/browser/media/router/mock_media_router.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Makes sure a MediaRouter can be created from an incognito Profile. | 46 // Makes sure a MediaRouter can be created from an incognito Profile. |
| 47 MediaRouter* router = | 47 MediaRouter* router = |
| 48 MediaRouterFactory::GetApiForBrowserContext(incognito_profile); | 48 MediaRouterFactory::GetApiForBrowserContext(incognito_profile); |
| 49 ASSERT_TRUE(router); | 49 ASSERT_TRUE(router); |
| 50 | 50 |
| 51 // A Profile and its incognito Profile share the same MediaRouter instance. | 51 // A Profile and its incognito Profile share the same MediaRouter instance. |
| 52 ASSERT_EQ(router, MediaRouterFactory::GetApiForBrowserContext(profile())); | 52 ASSERT_EQ(router, MediaRouterFactory::GetApiForBrowserContext(profile())); |
| 53 } | 53 } |
| 54 | 54 |
| 55 TEST_F(MediaRouterFactoryTest, IncognitoBrowserContextShutdown) { | 55 TEST_F(MediaRouterFactoryTest, IncognitoBrowserContextShutdown) { |
| 56 MediaRouterFactory::GetMediaRouterFactoryForTest()->SetTestingFactory( | 56 MediaRouterFactory::GetInstance()->SetTestingFactory( |
| 57 profile(), &CreateMockMediaRouter); | 57 profile(), &CreateMockMediaRouter); |
| 58 | 58 |
| 59 // Creates an incognito profile. | 59 // Creates an incognito profile. |
| 60 profile()->GetOffTheRecordProfile(); | 60 profile()->GetOffTheRecordProfile(); |
| 61 MockMediaRouter* router = static_cast<MockMediaRouter*>( | 61 MockMediaRouter* router = static_cast<MockMediaRouter*>( |
| 62 MediaRouterFactory::GetApiForBrowserContext(profile())); | 62 MediaRouterFactory::GetApiForBrowserContext(profile())); |
| 63 ASSERT_TRUE(router); | 63 ASSERT_TRUE(router); |
| 64 EXPECT_CALL(*router, OnIncognitoProfileShutdown()); | 64 EXPECT_CALL(*router, OnIncognitoProfileShutdown()); |
| 65 profile()->DestroyOffTheRecordProfile(); | 65 profile()->DestroyOffTheRecordProfile(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace media_router | 68 } // namespace media_router |
| OLD | NEW |