OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <memory> |
| 6 |
| 7 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" |
| 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace media_router { |
| 14 |
| 15 class OffscreenPresentationManagerFactoryTest : public testing::Test { |
| 16 protected: |
| 17 OffscreenPresentationManagerFactoryTest() {} |
| 18 ~OffscreenPresentationManagerFactoryTest() override {} |
| 19 |
| 20 Profile* profile() { return &profile_; } |
| 21 |
| 22 private: |
| 23 content::TestBrowserThreadBundle thread_bundle_; |
| 24 TestingProfile profile_; |
| 25 }; |
| 26 |
| 27 TEST_F(OffscreenPresentationManagerFactoryTest, CreateForRegularProfile) { |
| 28 ASSERT_TRUE(OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| 29 profile())); |
| 30 } |
| 31 |
| 32 TEST_F(OffscreenPresentationManagerFactoryTest, CreateForOffTheRecordProfile) { |
| 33 Profile* incognito_profile = profile()->GetOffTheRecordProfile(); |
| 34 ASSERT_TRUE(incognito_profile); |
| 35 |
| 36 // Makes sure a OffscreenPresentationManager can be created from an incognito |
| 37 // Profile. |
| 38 OffscreenPresentationManager* manager = |
| 39 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| 40 incognito_profile); |
| 41 ASSERT_TRUE(manager); |
| 42 |
| 43 // A Profile and its incognito Profile share the same |
| 44 // OffscreenPresentationManager instance. |
| 45 ASSERT_EQ(manager, |
| 46 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| 47 profile())); |
| 48 } |
| 49 |
| 50 } // namespace media_router |
OLD | NEW |