Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: chrome/test/ui/history_uitest.cc

Issue 164446: linux: More automation porting. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: automation ipc messages hack fix Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2008, Google Inc. 1 // Copyright 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 kTestCompleteSuccess, action_max_timeout_ms()); 86 kTestCompleteSuccess, action_max_timeout_ms());
87 87
88 // Test case 3 88 // Test case 3
89 std::wstring test_case_3 = L"history_length_test_page_4.html"; 89 std::wstring test_case_3 = L"history_length_test_page_4.html";
90 GURL url_3 = GetTestUrl(L"History", test_case_3); 90 GURL url_3 = GetTestUrl(L"History", test_case_3);
91 NavigateToURL(url_3); 91 NavigateToURL(url_3);
92 WaitForFinish("History_Length_Test_3", "1", url_3, kTestCompleteCookie, 92 WaitForFinish("History_Length_Test_3", "1", url_3, kTestCompleteCookie,
93 kTestCompleteSuccess, action_max_timeout_ms()); 93 kTestCompleteSuccess, action_max_timeout_ms());
94 } 94 }
95 95
96 #if defined(OS_WIN) 96 #if defined(OS_WIN) || defined(OS_LINUX)
97 // This test requires simulated mouse click, which is possible only for Windows.
98 TEST_F(HistoryTester, DISABLED_ConsiderRedirectAfterGestureAsUserInitiated) { 97 TEST_F(HistoryTester, DISABLED_ConsiderRedirectAfterGestureAsUserInitiated) {
99 // Test the history length for the following page transition. 98 // Test the history length for the following page transition.
100 // 99 //
101 // -open-> Page 11 -slow_redirect-> Page 12. 100 // -open-> Page 11 -slow_redirect-> Page 12.
102 // 101 //
103 // If redirect occurs after a user gesture, e.g., mouse click, the 102 // If redirect occurs after a user gesture, e.g., mouse click, the
104 // redirect is more likely to be user-initiated rather than automatic. 103 // redirect is more likely to be user-initiated rather than automatic.
105 // Therefore, Page 11 should be in the history in addition to Page 12. 104 // Therefore, Page 11 should be in the history in addition to Page 12.
106 105
107 std::wstring test_case = L"history_length_test_page_11.html"; 106 std::wstring test_case = L"history_length_test_page_11.html";
108 GURL url = GetTestUrl(L"History", test_case); 107 GURL url = GetTestUrl(L"History", test_case);
109 NavigateToURL(url); 108 NavigateToURL(url);
110 WaitForFinish("History_Length_Test_11", "1", url, kTestCompleteCookie, 109 WaitForFinish("History_Length_Test_11", "1", url, kTestCompleteCookie,
111 kTestCompleteSuccess, action_max_timeout_ms()); 110 kTestCompleteSuccess, action_max_timeout_ms());
112 111
113 // Simulate click. This only works for Windows. 112 // Simulate click. This only works for Windows.
114 scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0); 113 scoped_refptr<BrowserProxy> browser = automation()->GetBrowserWindow(0);
115 scoped_refptr<WindowProxy> window = browser->GetWindow(); 114 scoped_refptr<WindowProxy> window = browser->GetWindow();
116 gfx::Rect tab_view_bounds; 115 gfx::Rect tab_view_bounds;
117 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &tab_view_bounds, 116 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &tab_view_bounds,
118 true)); 117 true));
119 POINT point(tab_view_bounds.CenterPoint().ToPOINT());
120 ASSERT_TRUE( 118 ASSERT_TRUE(
121 window->SimulateOSClick(point, views::Event::EF_LEFT_BUTTON_DOWN)); 119 window->SimulateOSClick(tab_view_bounds.CenterPoint(),
120 views::Event::EF_LEFT_BUTTON_DOWN));
122 121
123 NavigateToURL(GURL("javascript:redirectToPage12()")); 122 NavigateToURL(GURL("javascript:redirectToPage12()"));
124 WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie, 123 WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie,
125 kTestCompleteSuccess, action_max_timeout_ms()); 124 kTestCompleteSuccess, action_max_timeout_ms());
126 } 125 }
127 #endif // defined(OS_WIN) 126 #endif // defined(OS_WIN) || defined(OS_LINUX)
128 127
129 TEST_F(HistoryTester, DISABLED_ConsiderSlowRedirectAsUserInitiated) { 128 TEST_F(HistoryTester, DISABLED_ConsiderSlowRedirectAsUserInitiated) {
130 // Test the history length for the following page transition. 129 // Test the history length for the following page transition.
131 // 130 //
132 // -open-> Page 21 -redirect-> Page 22. 131 // -open-> Page 21 -redirect-> Page 22.
133 // 132 //
134 // If redirect occurs more than 5 seconds later after the page is loaded, 133 // If redirect occurs more than 5 seconds later after the page is loaded,
135 // the redirect is likely to be user-initiated. 134 // the redirect is likely to be user-initiated.
136 // Therefore, Page 21 should be in the history in addition to Page 22. 135 // Therefore, Page 21 should be in the history in addition to Page 22.
137 136
138 std::wstring test_case = L"history_length_test_page_21.html"; 137 std::wstring test_case = L"history_length_test_page_21.html";
139 GURL url = GetTestUrl(L"History", test_case); 138 GURL url = GetTestUrl(L"History", test_case);
140 NavigateToURL(url); 139 NavigateToURL(url);
141 WaitForFinish("History_Length_Test_21", "1", url, kTestCompleteCookie, 140 WaitForFinish("History_Length_Test_21", "1", url, kTestCompleteCookie,
142 kTestCompleteSuccess, action_max_timeout_ms()); 141 kTestCompleteSuccess, action_max_timeout_ms());
143 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698