Chromium Code Reviews| Index: chrome/browser/media/router/offscreen_presentation_manager_factory_unittest.cc |
| diff --git a/chrome/browser/media/router/offscreen_presentation_manager_factory_unittest.cc b/chrome/browser/media/router/offscreen_presentation_manager_factory_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0d83b072dd8035e54584680f60da82af4e29754a |
| --- /dev/null |
| +++ b/chrome/browser/media/router/offscreen_presentation_manager_factory_unittest.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// 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/offscreen_presentation_manager_factory.h" |
| +#include "chrome/test/base/testing_profile.h" |
| +#include "content/public/browser/browser_context.h" |
| +#include "content/public/test/test_browser_thread_bundle.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace media_router { |
| + |
| +class OffscreenPresentationManagerFactoryTest : public testing::Test { |
| + protected: |
| + OffscreenPresentationManagerFactoryTest() {} |
| + ~OffscreenPresentationManagerFactoryTest() override {} |
| + |
| + Profile* profile() { return &profile_; } |
| + |
| + private: |
| + content::TestBrowserThreadBundle thread_bundle_; |
| + TestingProfile profile_; |
| +}; |
| + |
| +TEST_F(OffscreenPresentationManagerFactoryTest, CreateForRegularProfile) { |
| + ASSERT_TRUE(OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| + profile())); |
| +} |
| + |
| +TEST_F(OffscreenPresentationManagerFactoryTest, CreateForOffTheRecordProfile) { |
| + Profile* otr_profile = profile()->GetOffTheRecordProfile(); |
| + ASSERT_TRUE(otr_profile); |
| + |
| + // Makes sure a OffscreenPresentationManager can be created from an OTR |
|
mark a. foltz
2016/10/06 03:13:55
Recently, there was some renaming recently to try
zhaobin
2016/10/07 01:07:04
Done.
|
| + // Profile. |
| + OffscreenPresentationManager* manager = |
| + OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| + otr_profile); |
| + ASSERT_TRUE(manager); |
| + |
| + // A Profile and its OTR Profile share the same OffscreenPresentationManager |
| + // instance. |
| + ASSERT_EQ(manager, |
| + OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| + profile())); |
| +} |
| + |
| +} // namespace media_router |