OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/history/history.h" | 8 #include "chrome/browser/history/history.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 { | 137 { |
138 std::vector<GURL> urls(GetHistoryContents()); | 138 std::vector<GURL> urls(GetHistoryContents()); |
139 ASSERT_EQ(1U, urls.size()); | 139 ASSERT_EQ(1U, urls.size()); |
140 EXPECT_EQ(GetTestUrl().spec(), urls[0].spec()); | 140 EXPECT_EQ(GetTestUrl().spec(), urls[0].spec()); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 // Test that disabling saving browser history really works. | 144 // Test that disabling saving browser history really works. |
145 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabled) { | 145 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryDisabled) { |
146 base::TimeTicks start_time = base::TimeTicks::Now(); | |
147 | |
148 GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); | 146 GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); |
149 | 147 |
150 EXPECT_TRUE(GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); | 148 EXPECT_TRUE(GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS)); |
151 EXPECT_FALSE(GetProfile()->GetHistoryService(Profile::IMPLICIT_ACCESS)); | 149 EXPECT_FALSE(GetProfile()->GetHistoryService(Profile::IMPLICIT_ACCESS)); |
152 | 150 |
153 ui_test_utils::WaitForHistoryToLoad(browser()); | 151 ui_test_utils::WaitForHistoryToLoad(browser()); |
154 ExpectEmptyHistory(); | 152 ExpectEmptyHistory(); |
155 | 153 |
156 ui_test_utils::NavigateToURL(browser(), GetTestUrl()); | 154 ui_test_utils::NavigateToURL(browser(), GetTestUrl()); |
157 WaitForHistoryBackendToRun(); | 155 WaitForHistoryBackendToRun(); |
158 ExpectEmptyHistory(); | 156 ExpectEmptyHistory(); |
159 } | 157 } |
160 | 158 |
161 // Test that changing the pref takes effect immediately | 159 // Test that changing the pref takes effect immediately |
162 // when the browser is running. | 160 // when the browser is running. |
163 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabledThenDisabled) { | 161 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SavingHistoryEnabledThenDisabled) { |
164 base::TimeTicks start_time = base::TimeTicks::Now(); | |
165 | |
166 EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); | 162 EXPECT_FALSE(GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled)); |
167 | 163 |
168 ui_test_utils::WaitForHistoryToLoad(browser()); | 164 ui_test_utils::WaitForHistoryToLoad(browser()); |
169 | 165 |
170 ui_test_utils::NavigateToURL(browser(), GetTestUrl()); | 166 ui_test_utils::NavigateToURL(browser(), GetTestUrl()); |
171 WaitForHistoryBackendToRun(); | 167 WaitForHistoryBackendToRun(); |
172 | 168 |
173 { | 169 { |
174 std::vector<GURL> urls(GetHistoryContents()); | 170 std::vector<GURL> urls(GetHistoryContents()); |
175 ASSERT_EQ(1U, urls.size()); | 171 ASSERT_EQ(1U, urls.size()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 WaitForHistoryBackendToRun(); | 203 WaitForHistoryBackendToRun(); |
208 | 204 |
209 { | 205 { |
210 std::vector<GURL> urls(GetHistoryContents()); | 206 std::vector<GURL> urls(GetHistoryContents()); |
211 ASSERT_EQ(1U, urls.size()); | 207 ASSERT_EQ(1U, urls.size()); |
212 EXPECT_EQ(GetTestUrl().spec(), urls[0].spec()); | 208 EXPECT_EQ(GetTestUrl().spec(), urls[0].spec()); |
213 } | 209 } |
214 } | 210 } |
215 | 211 |
216 } // namespace | 212 } // namespace |
OLD | NEW |