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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ASSERT_TRUE(parent_zoom_map); | 141 ASSERT_TRUE(parent_zoom_map); |
142 | 142 |
143 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_25); | 143 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_25); |
144 ASSERT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 144 ASSERT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
145 zoom_level_25); | 145 zoom_level_25); |
146 | 146 |
147 // TODO(yosin) We need to wait ProfileImpl::Observe done for | 147 // TODO(yosin) We need to wait ProfileImpl::Observe done for |
148 // OnZoomLevelChanged. | 148 // OnZoomLevelChanged. |
149 | 149 |
150 // Prepare an off the record profile owned by the parent profile. | 150 // Prepare an off the record profile owned by the parent profile. |
151 parent_profile->SetOffTheRecordProfile( | |
152 scoped_ptr<Profile>(new OffTheRecordProfileImpl(parent_profile))); | |
153 OffTheRecordProfileImpl* child_profile = | 151 OffTheRecordProfileImpl* child_profile = |
154 static_cast<OffTheRecordProfileImpl*>( | 152 static_cast<OffTheRecordProfileImpl*>( |
155 parent_profile->GetOffTheRecordProfile()); | 153 parent_profile->GetOffTheRecordProfile()); |
156 child_profile->InitIoData(); | 154 child_profile->TrackZoomLevelsFromParent(parent_profile); |
157 child_profile->InitHostZoomMap(); | |
158 | 155 |
159 // Prepare child host zoom map. | 156 // Prepare child host zoom map. |
160 HostZoomMap* child_zoom_map = | 157 HostZoomMap* child_zoom_map = |
161 HostZoomMap::GetDefaultForBrowserContext(child_profile); | 158 HostZoomMap::GetDefaultForBrowserContext(child_profile); |
162 ASSERT_TRUE(child_zoom_map); | 159 ASSERT_TRUE(child_zoom_map); |
163 | 160 |
164 // Verify. | 161 // Verify. |
165 EXPECT_NE(parent_zoom_map, child_zoom_map); | 162 EXPECT_NE(parent_zoom_map, child_zoom_map); |
166 | 163 |
167 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 164 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
(...skipping 12 matching lines...) Expand all Loading... |
180 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); | 177 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); |
181 ASSERT_EQ( | 178 ASSERT_EQ( |
182 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 179 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
183 zoom_level_40); | 180 zoom_level_40); |
184 | 181 |
185 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 182 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
186 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << | 183 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << |
187 "Parent change should propagate to child."; | 184 "Parent change should propagate to child."; |
188 base::RunLoop().RunUntilIdle(); | 185 base::RunLoop().RunUntilIdle(); |
189 } | 186 } |
OLD | NEW |