Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: chrome/browser/media/router/offscreen_presentation_manager_factory_unittest.cc

Issue 2379703002: [Presentation API] (alternative) 1-UA: send message between controller and receiver page (Closed)
Patch Set: merge with master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..4d696309b233020589bd169f75cd8abe02a461be
--- /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* incognito_profile = profile()->GetOffTheRecordProfile();
+ ASSERT_TRUE(incognito_profile);
+
+ // Makes sure a OffscreenPresentationManager can be created from an incognito
+ // Profile.
+ OffscreenPresentationManager* manager =
+ OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext(
+ incognito_profile);
+ ASSERT_TRUE(manager);
+
+ // A Profile and its incognito Profile share the same
+ // OffscreenPresentationManager instance.
+ ASSERT_EQ(manager,
+ OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext(
+ profile()));
+}
+
+} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698