OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 FilePath().AppendASCII("form.html")); | 451 FilePath().AppendASCII("form.html")); |
452 GURL target = ui_test_utils::GetTestUrl( | 452 GURL target = ui_test_utils::GetTestUrl( |
453 FilePath().AppendASCII("History"), | 453 FilePath().AppendASCII("History"), |
454 FilePath().AppendASCII("target.html")); | 454 FilePath().AppendASCII("target.html")); |
455 ui_test_utils::NavigateToURL(browser(), form); | 455 ui_test_utils::NavigateToURL(browser(), form); |
456 | 456 |
457 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 457 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
458 string16 expected_title(ASCIIToUTF16("Target Page")); | 458 string16 expected_title(ASCIIToUTF16("Target Page")); |
459 content::TitleWatcher title_watcher( | 459 content::TitleWatcher title_watcher( |
460 chrome::GetActiveWebContents(browser()), expected_title); | 460 chrome::GetActiveWebContents(browser()), expected_title); |
461 ASSERT_TRUE(content::ExecuteJavaScript( | 461 ASSERT_TRUE(content::ExecuteScript( |
462 web_contents->GetRenderViewHost(), | 462 web_contents, "document.getElementById('form').submit()")); |
463 "", | |
464 "document.getElementById('form').submit()")); | |
465 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 463 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
466 | 464 |
467 std::vector<GURL> urls(GetHistoryContents()); | 465 std::vector<GURL> urls(GetHistoryContents()); |
468 ASSERT_EQ(2u, urls.size()); | 466 ASSERT_EQ(2u, urls.size()); |
469 ASSERT_EQ(target, urls[0]); | 467 ASSERT_EQ(target, urls[0]); |
470 ASSERT_EQ(form, urls[1]); | 468 ASSERT_EQ(form, urls[1]); |
471 } | 469 } |
472 | 470 |
473 // Verify history shortcut opens only one history tab per window. Also, make | 471 // Verify history shortcut opens only one history tab per window. Also, make |
474 // sure that existing history tab is activated. | 472 // sure that existing history tab is activated. |
(...skipping 15 matching lines...) Expand all Loading... |
490 | 488 |
491 content::WebContents* active_web_contents = | 489 content::WebContents* active_web_contents = |
492 browser()->tab_strip_model()->GetActiveWebContents(); | 490 browser()->tab_strip_model()->GetActiveWebContents(); |
493 ASSERT_EQ(web_contents, active_web_contents); | 491 ASSERT_EQ(web_contents, active_web_contents); |
494 ASSERT_EQ(history_url, active_web_contents->GetURL()); | 492 ASSERT_EQ(history_url, active_web_contents->GetURL()); |
495 | 493 |
496 content::WebContents* second_tab = | 494 content::WebContents* second_tab = |
497 browser()->tab_strip_model()->GetWebContentsAt(1); | 495 browser()->tab_strip_model()->GetWebContentsAt(1); |
498 ASSERT_NE(history_url, second_tab->GetURL()); | 496 ASSERT_NE(history_url, second_tab->GetURL()); |
499 } | 497 } |
OLD | NEW |