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

Side by Side Diff: chrome/browser/media/router/discovery/dial/dial_registry_factory_unittest.cc

Issue 2754703005: [Device Discovery] Make DialRegistry a Singleton (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 "base/memory/ptr_util.h"
8 #include "chrome/browser/media/router/discovery/dial/dial_registry.h"
9 #include "chrome/browser/media/router/discovery/dial/dial_registry_factory.h"
10 #include "chrome/test/base/testing_profile.h"
11 #include "content/public/browser/browser_context.h"
12 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace media_router {
16
17 class DialRegistryFactoryTest : public testing::Test {
18 protected:
19 DialRegistryFactoryTest() {}
20 ~DialRegistryFactoryTest() override {}
21
22 Profile* profile() { return &profile_; }
23
24 private:
25 content::TestBrowserThreadBundle thread_bundle_;
26 TestingProfile profile_;
27 };
28
29 TEST_F(DialRegistryFactoryTest, CreateForRegularProfile) {
30 ASSERT_TRUE(DialRegistryFactory::GetForBrowserContext(profile()));
31 }
32
33 TEST_F(DialRegistryFactoryTest, CreateForIncognitoProfile) {
34 Profile* incognito_profile = profile()->GetOffTheRecordProfile();
35 ASSERT_TRUE(incognito_profile);
36
37 // Makes sure a DialRegistry can be created from an incognito Profile.
38 scoped_refptr<DialRegistry> dial_registry =
39 DialRegistryFactory::GetForBrowserContext(incognito_profile);
40 ASSERT_TRUE(dial_registry);
41
42 // A Profile and its incognito Profile share the same DialRegistry instance.
43 ASSERT_EQ(dial_registry,
44 DialRegistryFactory::GetForBrowserContext(profile()));
45 }
46
47 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698