OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/off_the_record_profile_impl.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
6 | 6 |
7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 zoom_subscription_ = | 30 zoom_subscription_ = |
31 HostZoomMap::GetDefaultForBrowserContext(this) | 31 HostZoomMap::GetDefaultForBrowserContext(this) |
32 ->AddZoomLevelChangedCallback( | 32 ->AddZoomLevelChangedCallback( |
33 base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged, | 33 base::Bind(&TestingProfileWithHostZoomMap::OnZoomLevelChanged, |
34 base::Unretained(this))); | 34 base::Unretained(this))); |
35 } | 35 } |
36 | 36 |
37 virtual ~TestingProfileWithHostZoomMap() {} | 37 virtual ~TestingProfileWithHostZoomMap() {} |
38 | 38 |
39 // Profile overrides: | 39 // Profile overrides: |
40 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE { | 40 virtual PrefService* GetOffTheRecordPrefs() override { |
41 return GetPrefs(); | 41 return GetPrefs(); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 void OnZoomLevelChanged(const HostZoomMap::ZoomLevelChange& change) { | 45 void OnZoomLevelChanged(const HostZoomMap::ZoomLevelChange& change) { |
46 | 46 |
47 if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST) | 47 if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST) |
48 return; | 48 return; |
49 | 49 |
50 HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this); | 50 HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this); |
(...skipping 19 matching lines...) Expand all Loading... |
70 // We need to have a BrowserProcess in g_browser_process variable, since | 70 // We need to have a BrowserProcess in g_browser_process variable, since |
71 // OffTheRecordProfileImpl ctor uses it in | 71 // OffTheRecordProfileImpl ctor uses it in |
72 // ProfileIOData::InitializeProfileParams. | 72 // ProfileIOData::InitializeProfileParams. |
73 class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest { | 73 class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest { |
74 protected: | 74 protected: |
75 OffTheRecordProfileImplTest() {} | 75 OffTheRecordProfileImplTest() {} |
76 | 76 |
77 virtual ~OffTheRecordProfileImplTest() {} | 77 virtual ~OffTheRecordProfileImplTest() {} |
78 | 78 |
79 // testing::Test overrides: | 79 // testing::Test overrides: |
80 virtual void SetUp() OVERRIDE { | 80 virtual void SetUp() override { |
81 profile_manager_.reset(new TestingProfileManager(browser_process())); | 81 profile_manager_.reset(new TestingProfileManager(browser_process())); |
82 ASSERT_TRUE(profile_manager_->SetUp()); | 82 ASSERT_TRUE(profile_manager_->SetUp()); |
83 | 83 |
84 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); | 84 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); |
85 testing_io_thread_state_->io_thread_state()->globals()->host_resolver.reset( | 85 testing_io_thread_state_->io_thread_state()->globals()->host_resolver.reset( |
86 new net::MockHostResolver()); | 86 new net::MockHostResolver()); |
87 | 87 |
88 BrowserWithTestWindowTest::SetUp(); | 88 BrowserWithTestWindowTest::SetUp(); |
89 } | 89 } |
90 | 90 |
91 virtual void TearDown() OVERRIDE { | 91 virtual void TearDown() override { |
92 BrowserWithTestWindowTest::TearDown(); | 92 BrowserWithTestWindowTest::TearDown(); |
93 | 93 |
94 testing_io_thread_state_.reset(); | 94 testing_io_thread_state_.reset(); |
95 | 95 |
96 profile_manager_.reset(); | 96 profile_manager_.reset(); |
97 } | 97 } |
98 | 98 |
99 // BrowserWithTestWindowTest overrides: | 99 // BrowserWithTestWindowTest overrides: |
100 virtual TestingProfile* CreateProfile() OVERRIDE { | 100 virtual TestingProfile* CreateProfile() override { |
101 return new TestingProfileWithHostZoomMap; | 101 return new TestingProfileWithHostZoomMap; |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 TestingBrowserProcess* browser_process() { | 105 TestingBrowserProcess* browser_process() { |
106 return TestingBrowserProcess::GetGlobal(); | 106 return TestingBrowserProcess::GetGlobal(); |
107 } | 107 } |
108 | 108 |
109 scoped_ptr<TestingProfileManager> profile_manager_; | 109 scoped_ptr<TestingProfileManager> profile_manager_; |
110 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; | 110 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); | 175 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); |
176 ASSERT_EQ( | 176 ASSERT_EQ( |
177 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 177 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
178 zoom_level_40); | 178 zoom_level_40); |
179 | 179 |
180 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 180 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
181 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << | 181 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << |
182 "Parent change should propagate to child."; | 182 "Parent change should propagate to child."; |
183 base::RunLoop().RunUntilIdle(); | 183 base::RunLoop().RunUntilIdle(); |
184 } | 184 } |
OLD | NEW |