| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 content::NotificationService::AllSources()); | 427 content::NotificationService::AllSources()); |
| 428 SetOmniboxText(instant_url().Resolve("#q=puppies").spec()); | 428 SetOmniboxText(instant_url().Resolve("#q=puppies").spec()); |
| 429 PressEnterAndWaitForNavigation(); | 429 PressEnterAndWaitForNavigation(); |
| 430 observer_2.Wait(); | 430 observer_2.Wait(); |
| 431 | 431 |
| 432 // Should not have reused the tab. | 432 // Should not have reused the tab. |
| 433 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 433 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 434 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=puppies")); | 434 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=puppies")); |
| 435 } | 435 } |
| 436 | 436 |
| 437 #if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) | |
| 438 // Flaky crashes at shutdown on Linux Asan; http://crbug.com/517886. | |
| 439 #define MAYBE_OmniboxMarginSetForSearchURLs \ | |
| 440 DISABLED_OmniboxMarginSetForSearchURLs | |
| 441 #else | |
| 442 #define MAYBE_OmniboxMarginSetForSearchURLs OmniboxMarginSetForSearchURLs | |
| 443 #endif | |
| 444 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, | |
| 445 MAYBE_OmniboxMarginSetForSearchURLs) { | |
| 446 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | |
| 447 FocusOmnibox(); | |
| 448 | |
| 449 // Create an observer to wait for the instant tab to support Instant. | |
| 450 content::WindowedNotificationObserver observer( | |
| 451 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | |
| 452 content::NotificationService::AllSources()); | |
| 453 | |
| 454 SetOmniboxText("flowers"); | |
| 455 browser()->window()->GetLocationBar()->AcceptInput(); | |
| 456 observer.Wait(); | |
| 457 | |
| 458 const std::string& url = | |
| 459 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().spec(); | |
| 460 // Make sure we actually used search_url, not instant_url. | |
| 461 ASSERT_THAT(url, HasSubstr("&is_search")); | |
| 462 EXPECT_THAT(url, HasSubstr("&es_sm=")); | |
| 463 } | |
| 464 | |
| 465 // Test to verify that switching tabs should not dispatch onmostvisitedchanged | 437 // Test to verify that switching tabs should not dispatch onmostvisitedchanged |
| 466 // events. | 438 // events. |
| 467 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NoMostVisitedChangedOnTabSwitch) { | 439 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NoMostVisitedChangedOnTabSwitch) { |
| 468 // Initialize Instant. | 440 // Initialize Instant. |
| 469 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 441 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 470 | 442 |
| 471 // Open new tab. | 443 // Open new tab. |
| 472 ui_test_utils::NavigateToURLWithDisposition( | 444 ui_test_utils::NavigateToURLWithDisposition( |
| 473 browser(), | 445 browser(), |
| 474 GURL(chrome::kChromeUINewTabURL), | 446 GURL(chrome::kChromeUINewTabURL), |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 stream << "link.href = \"" << result_url.spec() << "\";"; | 978 stream << "link.href = \"" << result_url.spec() << "\";"; |
| 1007 stream << "document.body.appendChild(link);"; | 979 stream << "document.body.appendChild(link);"; |
| 1008 stream << "link.click();"; | 980 stream << "link.click();"; |
| 1009 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 981 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
| 1010 | 982 |
| 1011 content::WaitForLoadStop(contents); | 983 content::WaitForLoadStop(contents); |
| 1012 std::string expected_title = | 984 std::string expected_title = |
| 1013 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 985 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
| 1014 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 986 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
| 1015 } | 987 } |
| OLD | NEW |