| 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 "chrome/browser/net/ssl_config_service_manager.h" | 7 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 8 #include "chrome/browser/prefs/browser_prefs.h" | 8 #include "chrome/browser/prefs/browser_prefs.h" |
| 9 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 11 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 11 #include "chrome/browser/profiles/profile_dependency_manager.h" | 12 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/test/base/browser_with_test_window_test.h" | 14 #include "chrome/test/base/browser_with_test_window_test.h" |
| 14 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
| 15 #include "chrome/test/base/testing_pref_service.h" | 16 #include "chrome/test/base/testing_pref_service.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 17 #include "content/public/browser/host_zoom_map.h" | 18 #include "content/public/browser/host_zoom_map.h" |
| 18 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // OffTheRecordProfileImpl ctor uses it in | 80 // OffTheRecordProfileImpl ctor uses it in |
| 80 // ProfileIOData::InitializeProfileParams. | 81 // ProfileIOData::InitializeProfileParams. |
| 81 class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest { | 82 class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest { |
| 82 protected: | 83 protected: |
| 83 OffTheRecordProfileImplTest() {} | 84 OffTheRecordProfileImplTest() {} |
| 84 | 85 |
| 85 virtual ~OffTheRecordProfileImplTest() {} | 86 virtual ~OffTheRecordProfileImplTest() {} |
| 86 | 87 |
| 87 virtual void SetUp() OVERRIDE { | 88 virtual void SetUp() OVERRIDE { |
| 88 prefs_.reset(new TestingPrefServiceSimple); | 89 prefs_.reset(new TestingPrefServiceSimple); |
| 89 chrome::RegisterLocalState(prefs_.get()); | 90 chrome::RegisterLocalState(prefs_->registry(), prefs_.get()); |
| 90 | 91 |
| 91 browser_process()->SetLocalState(prefs_.get()); | 92 browser_process()->SetLocalState(prefs_.get()); |
| 92 | 93 |
| 93 BrowserWithTestWindowTest::SetUp(); | 94 BrowserWithTestWindowTest::SetUp(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 virtual void TearDown() OVERRIDE { | 97 virtual void TearDown() OVERRIDE { |
| 97 BrowserWithTestWindowTest::TearDown(); | 98 BrowserWithTestWindowTest::TearDown(); |
| 98 browser_process()->SetLocalState(NULL); | 99 browser_process()->SetLocalState(NULL); |
| 99 DestroyBrowserAndProfile(); | 100 DestroyBrowserAndProfile(); |
| 100 prefs_.reset(); | 101 prefs_.reset(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 TestingBrowserProcess* browser_process() { | 105 TestingBrowserProcess* browser_process() { |
| 105 return TestingBrowserProcess::GetGlobal(); | 106 return TestingBrowserProcess::GetGlobal(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 scoped_ptr<PrefServiceSimple> prefs_; | 109 scoped_ptr<TestingPrefServiceSimple> prefs_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImplTest); | 111 DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImplTest); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 // Test four things: | 114 // Test four things: |
| 114 // 1. Host zoom maps of parent profile and child profile are different. | 115 // 1. Host zoom maps of parent profile and child profile are different. |
| 115 // 2. Child host zoom map inherites zoom level at construction. | 116 // 2. Child host zoom map inherites zoom level at construction. |
| 116 // 3. Change of zoom level doesn't propagate from child to parent. | 117 // 3. Change of zoom level doesn't propagate from child to parent. |
| 117 // 4. Change of zoom level propagate from parent to child. | 118 // 4. Change of zoom level propagate from parent to child. |
| 118 TEST_F(OffTheRecordProfileImplTest, GetHostZoomMap) { | 119 TEST_F(OffTheRecordProfileImplTest, GetHostZoomMap) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 child_zoom_map->GetZoomLevel(host)) << | 167 child_zoom_map->GetZoomLevel(host)) << |
| 167 "Child change must not propagate to parent."; | 168 "Child change must not propagate to parent."; |
| 168 | 169 |
| 169 parent_zoom_map->SetZoomLevel(host, zoom_level_40); | 170 parent_zoom_map->SetZoomLevel(host, zoom_level_40); |
| 170 ASSERT_EQ(parent_zoom_map->GetZoomLevel(host), zoom_level_40); | 171 ASSERT_EQ(parent_zoom_map->GetZoomLevel(host), zoom_level_40); |
| 171 | 172 |
| 172 EXPECT_EQ(parent_zoom_map->GetZoomLevel(host), | 173 EXPECT_EQ(parent_zoom_map->GetZoomLevel(host), |
| 173 child_zoom_map->GetZoomLevel(host)) << | 174 child_zoom_map->GetZoomLevel(host)) << |
| 174 "Parent change should propagate to child."; | 175 "Parent change should propagate to child."; |
| 175 } | 176 } |
| OLD | NEW |