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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
66 class HistoryBrowserTest : public InProcessBrowserTest { | 66 class HistoryBrowserTest : public InProcessBrowserTest { |
67 protected: | 67 protected: |
68 HistoryBrowserTest() | 68 HistoryBrowserTest() |
69 : test_server_(net::SpawnedTestServer::TYPE_HTTP, | 69 : test_server_(net::SpawnedTestServer::TYPE_HTTP, |
70 net::SpawnedTestServer::kLocalhost, | 70 net::SpawnedTestServer::kLocalhost, |
71 base::FilePath(kDocRoot)) {} | 71 base::FilePath(kDocRoot)) {} |
72 | 72 |
73 void SetUp() override { ASSERT_TRUE(test_server_.Start()); } | 73 void SetUp() override { |
| 74 ASSERT_TRUE(test_server_.Start()); |
| 75 InProcessBrowserTest::SetUp(); |
| 76 } |
74 | 77 |
75 PrefService* GetPrefs() { | 78 PrefService* GetPrefs() { |
76 return GetProfile()->GetPrefs(); | 79 return GetProfile()->GetPrefs(); |
77 } | 80 } |
78 | 81 |
79 Profile* GetProfile() { | 82 Profile* GetProfile() { |
80 return browser()->profile(); | 83 return browser()->profile(); |
81 } | 84 } |
82 | 85 |
83 std::vector<GURL> GetHistoryContents() { | 86 std::vector<GURL> GetHistoryContents() { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 ui_test_utils::NavigateToURL(browser(), GetTestUrl()); | 214 ui_test_utils::NavigateToURL(browser(), GetTestUrl()); |
212 WaitForHistoryBackendToRun(); | 215 WaitForHistoryBackendToRun(); |
213 | 216 |
214 { | 217 { |
215 std::vector<GURL> urls(GetHistoryContents()); | 218 std::vector<GURL> urls(GetHistoryContents()); |
216 ASSERT_EQ(1U, urls.size()); | 219 ASSERT_EQ(1U, urls.size()); |
217 EXPECT_EQ(GetTestUrl().spec(), urls[0].spec()); | 220 EXPECT_EQ(GetTestUrl().spec(), urls[0].spec()); |
218 } | 221 } |
219 } | 222 } |
220 | 223 |
221 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, VerifyHistoryLength1) { | 224 // Disabled after fixing this test class. See http://crbug.com/511442 for |
| 225 // details. |
| 226 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, DISABLED_VerifyHistoryLength1) { |
222 // Test the history length for the following page transitions. | 227 // Test the history length for the following page transitions. |
223 // -open-> Page 1. | 228 // -open-> Page 1. |
224 LoadAndWaitForFile("history_length_test_page_1.html"); | 229 LoadAndWaitForFile("history_length_test_page_1.html"); |
225 } | 230 } |
226 | 231 |
227 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, VerifyHistoryLength2) { | 232 // Disabled after fixing this test class. See http://crbug.com/511442 for |
| 233 // details. |
| 234 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, DISABLED_VerifyHistoryLength2) { |
228 // Test the history length for the following page transitions. | 235 // Test the history length for the following page transitions. |
229 // -open-> Page 2 -redirect-> Page 3. | 236 // -open-> Page 2 -redirect-> Page 3. |
230 LoadAndWaitForFile("history_length_test_page_2.html"); | 237 LoadAndWaitForFile("history_length_test_page_2.html"); |
231 } | 238 } |
232 | 239 |
233 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, VerifyHistoryLength3) { | 240 // Disabled after fixing this test class. See http://crbug.com/511442 for |
| 241 // details. |
| 242 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, DISABLED_VerifyHistoryLength3) { |
234 // Test the history length for the following page transitions. | 243 // Test the history length for the following page transitions. |
235 // -open-> Page 1 -> open Page 2 -redirect Page 3. open Page 4 | 244 // -open-> Page 1 -> open Page 2 -redirect Page 3. open Page 4 |
236 // -navigate_backward-> Page 3 -navigate_backward->Page 1 | 245 // -navigate_backward-> Page 3 -navigate_backward->Page 1 |
237 // -navigate_forward-> Page 3 -navigate_forward-> Page 4 | 246 // -navigate_forward-> Page 3 -navigate_forward-> Page 4 |
238 LoadAndWaitForFile("history_length_test_page_1.html"); | 247 LoadAndWaitForFile("history_length_test_page_1.html"); |
239 LoadAndWaitForFile("history_length_test_page_2.html"); | 248 LoadAndWaitForFile("history_length_test_page_2.html"); |
240 LoadAndWaitForFile("history_length_test_page_4.html"); | 249 LoadAndWaitForFile("history_length_test_page_4.html"); |
241 } | 250 } |
242 | 251 |
| 252 // Disabled after fixing this test class. See http://crbug.com/511442 for |
| 253 // details. |
243 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, | 254 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, |
244 ConsiderRedirectAfterGestureAsUserInitiated) { | 255 DISABLED_ConsiderRedirectAfterGestureAsUserInitiated) { |
245 // Test the history length for the following page transition. | 256 // Test the history length for the following page transition. |
246 // | 257 // |
247 // -open-> Page 11 -slow_redirect-> Page 12. | 258 // -open-> Page 11 -slow_redirect-> Page 12. |
248 // | 259 // |
249 // If redirect occurs after a user gesture, e.g., mouse click, the | 260 // If redirect occurs after a user gesture, e.g., mouse click, the |
250 // redirect is more likely to be user-initiated rather than automatic. | 261 // redirect is more likely to be user-initiated rather than automatic. |
251 // Therefore, Page 11 should be in the history in addition to Page 12. | 262 // Therefore, Page 11 should be in the history in addition to Page 12. |
252 LoadAndWaitForFile("history_length_test_page_11.html"); | 263 LoadAndWaitForFile("history_length_test_page_11.html"); |
253 | 264 |
254 content::SimulateMouseClick( | 265 content::SimulateMouseClick( |
255 browser()->tab_strip_model()->GetActiveWebContents(), 0, | 266 browser()->tab_strip_model()->GetActiveWebContents(), 0, |
256 blink::WebMouseEvent::ButtonLeft); | 267 blink::WebMouseEvent::ButtonLeft); |
257 LoadAndWaitForFile("history_length_test_page_11.html"); | 268 LoadAndWaitForFile("history_length_test_page_11.html"); |
258 } | 269 } |
259 | 270 |
| 271 // Disabled after fixing this test class. See http://crbug.com/511442 for |
| 272 // details. |
260 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, | 273 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, |
261 ConsiderSlowRedirectAsUserInitiated) { | 274 DISABLED_ConsiderSlowRedirectAsUserInitiated) { |
262 // Test the history length for the following page transition. | 275 // Test the history length for the following page transition. |
263 // | 276 // |
264 // -open-> Page 21 -redirect-> Page 22. | 277 // -open-> Page 21 -redirect-> Page 22. |
265 // | 278 // |
266 // If redirect occurs more than 5 seconds later after the page is loaded, | 279 // If redirect occurs more than 5 seconds later after the page is loaded, |
267 // the redirect is likely to be user-initiated. | 280 // the redirect is likely to be user-initiated. |
268 // Therefore, Page 21 should be in the history in addition to Page 22. | 281 // Therefore, Page 21 should be in the history in addition to Page 22. |
269 LoadAndWaitForFile("history_length_test_page_21.html"); | 282 LoadAndWaitForFile("history_length_test_page_21.html"); |
270 } | 283 } |
271 | 284 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 520 |
508 content::WebContents* active_web_contents = | 521 content::WebContents* active_web_contents = |
509 browser()->tab_strip_model()->GetActiveWebContents(); | 522 browser()->tab_strip_model()->GetActiveWebContents(); |
510 ASSERT_EQ(web_contents, active_web_contents); | 523 ASSERT_EQ(web_contents, active_web_contents); |
511 ASSERT_EQ(history_url, active_web_contents->GetURL()); | 524 ASSERT_EQ(history_url, active_web_contents->GetURL()); |
512 | 525 |
513 content::WebContents* second_tab = | 526 content::WebContents* second_tab = |
514 browser()->tab_strip_model()->GetWebContentsAt(1); | 527 browser()->tab_strip_model()->GetWebContentsAt(1); |
515 ASSERT_NE(history_url, second_tab->GetURL()); | 528 ASSERT_NE(history_url, second_tab->GetURL()); |
516 } | 529 } |
OLD | NEW |