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

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

Issue 6312154: Remove wstring from RVH's run Javascript command.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 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 // 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"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 GURL file_url = net::FilePathToFileURL(test_file); 253 GURL file_url = net::FilePathToFileURL(test_file);
254 254
255 GURL initial_url = test_server_.GetURL( 255 GURL initial_url = test_server_.GetURL(
256 "client-redirect?" + file_url.spec()); 256 "client-redirect?" + file_url.spec());
257 257
258 NavigateToURL(initial_url); 258 NavigateToURL(initial_url);
259 // UITest will check for crashes. We make sure the title doesn't match the 259 // UITest will check for crashes. We make sure the title doesn't match the
260 // title from the file, because the nav should not have taken place. 260 // title from the file, because the nav should not have taken place.
261 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 261 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
262 ASSERT_TRUE(tab_proxy.get()); 262 ASSERT_TRUE(tab_proxy.get());
263 std::wstring actual_title; 263 string16 actual_title;
264 ASSERT_TRUE(tab_proxy->GetTabTitle(&actual_title)); 264 ASSERT_TRUE(tab_proxy->GetTabTitle(&actual_title));
265 EXPECT_NE("File!", WideToUTF8(actual_title)); 265 EXPECT_NE("File!", UTF16ToUTF8(actual_title));
266 } 266 }
267 267
268 // Ensures that non-user initiated location changes (within page) are 268 // Ensures that non-user initiated location changes (within page) are
269 // flagged as client redirects. See bug 1139823. 269 // flagged as client redirects. See bug 1139823.
270 TEST_F(RedirectTest, ClientFragments) { 270 TEST_F(RedirectTest, ClientFragments) {
271 ASSERT_TRUE(test_server_.Start()); 271 ASSERT_TRUE(test_server_.Start());
272 272
273 FilePath test_file(test_data_directory_); 273 FilePath test_file(test_data_directory_);
274 test_file = test_file.AppendASCII("ref_redirect.html"); 274 test_file = test_file.AppendASCII("ref_redirect.html");
275 GURL first_url = net::FilePathToFileURL(test_file); 275 GURL first_url = net::FilePathToFileURL(test_file);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 "client-redirect?" + slow.spec()); 308 "client-redirect?" + slow.spec());
309 std::vector<GURL> redirects; 309 std::vector<GURL> redirects;
310 310
311 NavigateToURL(first_url); 311 NavigateToURL(first_url);
312 // We don't sleep here - the first navigation won't have been committed yet 312 // We don't sleep here - the first navigation won't have been committed yet
313 // because we told the server to wait a minute. This means the browser has 313 // because we told the server to wait a minute. This means the browser has
314 // started it's provisional load for the client redirect destination page but 314 // started it's provisional load for the client redirect destination page but
315 // hasn't completed. Our time is now! 315 // hasn't completed. Our time is now!
316 NavigateToURL(final_url); 316 NavigateToURL(final_url);
317 317
318 std::wstring tab_title; 318 string16 tab_title;
319 std::wstring final_url_title = UTF8ToWide("Title Of Awesomeness"); 319 string16 final_url_title = ASCIIToUTF16("Title Of Awesomeness");
320 // Wait till the final page has been loaded. 320 // Wait till the final page has been loaded.
321 for (int i = 0; i < 10; ++i) { 321 for (int i = 0; i < 10; ++i) {
322 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); 322 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
323 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 323 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
324 ASSERT_TRUE(tab_proxy.get()); 324 ASSERT_TRUE(tab_proxy.get());
325 ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title)); 325 ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title));
326 if (tab_title == final_url_title) { 326 if (tab_title == final_url_title) {
327 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); 327 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
328 break; 328 break;
329 } 329 }
(...skipping 10 matching lines...) Expand all
340 it != redirects.end(); ++it) { 340 it != redirects.end(); ++it) {
341 if (final_url.spec() == it->spec()) { 341 if (final_url.spec() == it->spec()) {
342 final_navigation_not_redirect = false; 342 final_navigation_not_redirect = false;
343 break; 343 break;
344 } 344 }
345 } 345 }
346 EXPECT_TRUE(final_navigation_not_redirect); 346 EXPECT_TRUE(final_navigation_not_redirect);
347 } 347 }
348 348
349 } // namespace 349 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698