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

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

Issue 2343013002: [Presentation API] (MR side) 1-UA: notify receiver page when receiver connection becomes available (Closed)
Patch Set: resolve code review comments from Derek Created 4 years, 3 months 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..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
+ // 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

Powered by Google App Engine
This is Rietveld 408576698