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