| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ASSERT_TRUE(parent_zoom_map); | 135 ASSERT_TRUE(parent_zoom_map); |
| 136 | 136 |
| 137 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_25); | 137 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_25); |
| 138 ASSERT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 138 ASSERT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
| 139 zoom_level_25); | 139 zoom_level_25); |
| 140 | 140 |
| 141 // TODO(yosin) We need to wait ProfileImpl::Observe done for | 141 // TODO(yosin) We need to wait ProfileImpl::Observe done for |
| 142 // OnZoomLevelChanged. | 142 // OnZoomLevelChanged. |
| 143 | 143 |
| 144 // Prepare an off the record profile owned by the parent profile. | 144 // Prepare an off the record profile owned by the parent profile. |
| 145 parent_profile->SetOffTheRecordProfile( | |
| 146 scoped_ptr<Profile>(new OffTheRecordProfileImpl(parent_profile))); | |
| 147 OffTheRecordProfileImpl* child_profile = | 145 OffTheRecordProfileImpl* child_profile = |
| 148 static_cast<OffTheRecordProfileImpl*>( | 146 static_cast<OffTheRecordProfileImpl*>( |
| 149 parent_profile->GetOffTheRecordProfile()); | 147 parent_profile->GetOffTheRecordProfile()); |
| 150 child_profile->InitIoData(); | |
| 151 child_profile->InitHostZoomMap(); | |
| 152 | 148 |
| 153 // Prepare child host zoom map. | 149 // Prepare child host zoom map. |
| 154 HostZoomMap* child_zoom_map = | 150 HostZoomMap* child_zoom_map = |
| 155 HostZoomMap::GetForBrowserContext(child_profile); | 151 HostZoomMap::GetForBrowserContext(child_profile); |
| 156 ASSERT_TRUE(child_zoom_map); | 152 ASSERT_TRUE(child_zoom_map); |
| 157 | 153 |
| 158 // Verify. | 154 // Verify. |
| 159 EXPECT_NE(parent_zoom_map, child_zoom_map); | 155 EXPECT_NE(parent_zoom_map, child_zoom_map); |
| 160 | 156 |
| 161 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 157 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 174 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); | 170 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); |
| 175 ASSERT_EQ( | 171 ASSERT_EQ( |
| 176 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 172 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
| 177 zoom_level_40); | 173 zoom_level_40); |
| 178 | 174 |
| 179 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 175 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
| 180 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << | 176 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << |
| 181 "Parent change should propagate to child."; | 177 "Parent change should propagate to child."; |
| 182 base::RunLoop().RunUntilIdle(); | 178 base::RunLoop().RunUntilIdle(); |
| 183 } | 179 } |
| OLD | NEW |