| 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 // History UI tests | 5 // History UI tests |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
| 10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); | 77 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); |
| 78 | 78 |
| 79 const FilePath test_case_3( | 79 const FilePath test_case_3( |
| 80 FILE_PATH_LITERAL("history_length_test_page_4.html")); | 80 FILE_PATH_LITERAL("history_length_test_page_4.html")); |
| 81 GURL url_3 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_3); | 81 GURL url_3 = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case_3); |
| 82 NavigateToURL(url_3); | 82 NavigateToURL(url_3); |
| 83 WaitForFinish("History_Length_Test_3", "1", url_3, kTestCompleteCookie, | 83 WaitForFinish("History_Length_Test_3", "1", url_3, kTestCompleteCookie, |
| 84 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); | 84 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 #if defined(OS_WIN) || defined(OS_LINUX) | 87 #if !defined(OS_MACOSX) |
| 88 TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) { | 88 TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) { |
| 89 // Test the history length for the following page transition. | 89 // Test the history length for the following page transition. |
| 90 // | 90 // |
| 91 // -open-> Page 11 -slow_redirect-> Page 12. | 91 // -open-> Page 11 -slow_redirect-> Page 12. |
| 92 // | 92 // |
| 93 // If redirect occurs after a user gesture, e.g., mouse click, the | 93 // If redirect occurs after a user gesture, e.g., mouse click, the |
| 94 // redirect is more likely to be user-initiated rather than automatic. | 94 // redirect is more likely to be user-initiated rather than automatic. |
| 95 // Therefore, Page 11 should be in the history in addition to Page 12. | 95 // Therefore, Page 11 should be in the history in addition to Page 12. |
| 96 | 96 |
| 97 const FilePath test_case( | 97 const FilePath test_case( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 gfx::Rect tab_view_bounds; | 109 gfx::Rect tab_view_bounds; |
| 110 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &tab_view_bounds, | 110 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &tab_view_bounds, |
| 111 true)); | 111 true)); |
| 112 ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(), | 112 ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(), |
| 113 ui::EF_LEFT_BUTTON_DOWN)); | 113 ui::EF_LEFT_BUTTON_DOWN)); |
| 114 | 114 |
| 115 NavigateToURL(GURL("javascript:redirectToPage12()")); | 115 NavigateToURL(GURL("javascript:redirectToPage12()")); |
| 116 WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie, | 116 WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie, |
| 117 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); | 117 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); |
| 118 } | 118 } |
| 119 #endif // defined(OS_WIN) || defined(OS_LINUX) | 119 #endif // !defined(OS_MACOSX) |
| 120 | 120 |
| 121 TEST_F(HistoryTester, ConsiderSlowRedirectAsUserInitiated) { | 121 TEST_F(HistoryTester, ConsiderSlowRedirectAsUserInitiated) { |
| 122 // Test the history length for the following page transition. | 122 // Test the history length for the following page transition. |
| 123 // | 123 // |
| 124 // -open-> Page 21 -redirect-> Page 22. | 124 // -open-> Page 21 -redirect-> Page 22. |
| 125 // | 125 // |
| 126 // If redirect occurs more than 5 seconds later after the page is loaded, | 126 // If redirect occurs more than 5 seconds later after the page is loaded, |
| 127 // the redirect is likely to be user-initiated. | 127 // the redirect is likely to be user-initiated. |
| 128 // Therefore, Page 21 should be in the history in addition to Page 22. | 128 // Therefore, Page 21 should be in the history in addition to Page 22. |
| 129 | 129 |
| 130 const FilePath test_case( | 130 const FilePath test_case( |
| 131 FILE_PATH_LITERAL("history_length_test_page_21.html")); | 131 FILE_PATH_LITERAL("history_length_test_page_21.html")); |
| 132 GURL url = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case); | 132 GURL url = ui_test_utils::GetTestUrl(FilePath(kHistoryDir), test_case); |
| 133 NavigateToURL(url); | 133 NavigateToURL(url); |
| 134 WaitForFinish("History_Length_Test_21", "1", url, kTestCompleteCookie, | 134 WaitForFinish("History_Length_Test_21", "1", url, kTestCompleteCookie, |
| 135 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); | 135 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); |
| 136 } | 136 } |
| OLD | NEW |