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

Side by Side Diff: chrome/browser/history/redirect_uitest.cc

Issue 9215005: Revert 117824 - Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 (c) 2012 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 // Navigates the browser to server and client redirect pages and makes sure 5 // Navigates the browser to server and client redirect pages and makes sure
6 // that the correct redirects are reflected in the history database. Errors 6 // that the correct redirects are reflected in the history database. Errors
7 // here might indicate that WebKit changed the calls our glue layer gets in 7 // here might indicate that WebKit changed the calls our glue layer gets in
8 // the case of redirects. It may also mean problems with the history system. 8 // the case of redirects. It may also mean problems with the history system.
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 "server-redirect?" + next_to_last.spec()); 207 "server-redirect?" + next_to_last.spec());
208 GURL first_url = test_server_.GetURL( 208 GURL first_url = test_server_.GetURL(
209 "client-redirect?" + second_url.spec()); 209 "client-redirect?" + second_url.spec());
210 std::vector<GURL> redirects; 210 std::vector<GURL> redirects;
211 211
212 // We need the sleep for the client redirects, because it appears as two 212 // We need the sleep for the client redirects, because it appears as two
213 // page visits in the browser. 213 // page visits in the browser.
214 NavigateToURL(first_url); 214 NavigateToURL(first_url);
215 215
216 for (int i = 0; i < 10; ++i) { 216 for (int i = 0; i < 10; ++i) {
217 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 217 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
218 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 218 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
219 ASSERT_TRUE(tab_proxy.get()); 219 ASSERT_TRUE(tab_proxy.get());
220 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); 220 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
221 if (!redirects.empty()) 221 if (!redirects.empty())
222 break; 222 break;
223 } 223 }
224 224
225 ASSERT_EQ(3U, redirects.size()); 225 ASSERT_EQ(3U, redirects.size());
226 EXPECT_EQ(second_url.spec(), redirects[0].spec()); 226 EXPECT_EQ(second_url.spec(), redirects[0].spec());
227 EXPECT_EQ(next_to_last.spec(), redirects[1].spec()); 227 EXPECT_EQ(next_to_last.spec(), redirects[1].spec());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // We don't sleep here - the first navigation won't have been committed yet 315 // We don't sleep here - the first navigation won't have been committed yet
316 // because we told the server to wait a minute. This means the browser has 316 // because we told the server to wait a minute. This means the browser has
317 // started it's provisional load for the client redirect destination page but 317 // started it's provisional load for the client redirect destination page but
318 // hasn't completed. Our time is now! 318 // hasn't completed. Our time is now!
319 NavigateToURL(final_url); 319 NavigateToURL(final_url);
320 320
321 std::wstring tab_title; 321 std::wstring tab_title;
322 std::wstring final_url_title = UTF8ToWide("Title Of Awesomeness"); 322 std::wstring final_url_title = UTF8ToWide("Title Of Awesomeness");
323 // Wait till the final page has been loaded. 323 // Wait till the final page has been loaded.
324 for (int i = 0; i < 10; ++i) { 324 for (int i = 0; i < 10; ++i) {
325 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 325 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
326 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 326 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
327 ASSERT_TRUE(tab_proxy.get()); 327 ASSERT_TRUE(tab_proxy.get());
328 ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title)); 328 ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title));
329 if (tab_title == final_url_title) { 329 if (tab_title == final_url_title) {
330 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); 330 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
331 break; 331 break;
332 } 332 }
333 } 333 }
334 334
335 // Check to make sure the navigation did in fact take place and we are 335 // Check to make sure the navigation did in fact take place and we are
336 // at the expected page. 336 // at the expected page.
337 EXPECT_EQ(final_url_title, tab_title); 337 EXPECT_EQ(final_url_title, tab_title);
338 338
339 bool final_navigation_not_redirect = true; 339 bool final_navigation_not_redirect = true;
340 // Check to make sure our request for files/title2.html doesn't get flagged 340 // Check to make sure our request for files/title2.html doesn't get flagged
341 // as a client redirect from the first (/client-redirect?) page. 341 // as a client redirect from the first (/client-redirect?) page.
342 for (std::vector<GURL>::iterator it = redirects.begin(); 342 for (std::vector<GURL>::iterator it = redirects.begin();
343 it != redirects.end(); ++it) { 343 it != redirects.end(); ++it) {
344 if (final_url.spec() == it->spec()) { 344 if (final_url.spec() == it->spec()) {
345 final_navigation_not_redirect = false; 345 final_navigation_not_redirect = false;
346 break; 346 break;
347 } 347 }
348 } 348 }
349 EXPECT_TRUE(final_navigation_not_redirect); 349 EXPECT_TRUE(final_navigation_not_redirect);
350 } 350 }
351 351
352 } // namespace 352 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/history/text_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698