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

Side by Side Diff: content/browser/session_history_browsertest.cc

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 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) 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "content/public/browser/navigation_controller.h" 7 #include "content/public/browser/navigation_controller.h"
8 #include "content/public/browser/notification_service.h" 8 #include "content/public/browser/notification_service.h"
9 #include "content/public/browser/notification_types.h" 9 #include "content/public/browser/notification_types.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 GoBack(); 425 GoBack();
426 EXPECT_EQ("Default Title", GetTabTitle()); 426 EXPECT_EQ("Default Title", GetTabTitle());
427 } 427 }
428 428
429 // http://code.google.com/p/chromium/issues/detail?id=56267 429 // http://code.google.com/p/chromium/issues/detail?id=56267
430 IN_PROC_BROWSER_TEST_F(SessionHistoryTest, HistoryLength) { 430 IN_PROC_BROWSER_TEST_F(SessionHistoryTest, HistoryLength) {
431 int length; 431 int length;
432 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( 432 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt(
433 shell()->web_contents()->GetRenderViewHost(), 433 shell()->web_contents()->GetRenderViewHost(),
434 L"", L"domAutomationController.send(history.length)", &length)); 434 "",
435 "domAutomationController.send(history.length)",
436 &length));
435 EXPECT_EQ(1, length); 437 EXPECT_EQ(1, length);
436 438
437 NavigateToURL(shell(), GetURL("title1.html")); 439 NavigateToURL(shell(), GetURL("title1.html"));
438 440
439 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( 441 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt(
440 shell()->web_contents()->GetRenderViewHost(), 442 shell()->web_contents()->GetRenderViewHost(),
441 L"", L"domAutomationController.send(history.length)", &length)); 443 "",
444 "domAutomationController.send(history.length)",
445 &length));
442 EXPECT_EQ(2, length); 446 EXPECT_EQ(2, length);
443 447
444 // Now test that history.length is updated when the navigation is committed. 448 // Now test that history.length is updated when the navigation is committed.
445 NavigateToURL(shell(), GetURL("record_length.html")); 449 NavigateToURL(shell(), GetURL("record_length.html"));
446 450
447 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( 451 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt(
448 shell()->web_contents()->GetRenderViewHost(), 452 shell()->web_contents()->GetRenderViewHost(),
449 L"", L"domAutomationController.send(history.length)", &length)); 453 "",
454 "domAutomationController.send(history.length)",
455 &length));
450 EXPECT_EQ(3, length); 456 EXPECT_EQ(3, length);
451 457
452 GoBack(); 458 GoBack();
453 GoBack(); 459 GoBack();
454 460
455 // Ensure history.length is properly truncated. 461 // Ensure history.length is properly truncated.
456 NavigateToURL(shell(), GetURL("title2.html")); 462 NavigateToURL(shell(), GetURL("title2.html"));
457 463
458 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt( 464 ASSERT_TRUE(ExecuteJavaScriptAndExtractInt(
459 shell()->web_contents()->GetRenderViewHost(), 465 shell()->web_contents()->GetRenderViewHost(),
460 L"", L"domAutomationController.send(history.length)", &length)); 466 "",
467 "domAutomationController.send(history.length)",
468 &length));
461 EXPECT_EQ(2, length); 469 EXPECT_EQ(2, length);
462 } 470 }
463 471
464 } // namespace content 472 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698