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

Unified Diff: chrome/browser/instant/instant_extended_browsertest.cc

Issue 11644009: Added support for passing WindowOpenDisposition into BrowserInstantController::OpenURL() from the o… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_page.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_extended_browsertest.cc
diff --git a/chrome/browser/instant/instant_extended_browsertest.cc b/chrome/browser/instant/instant_extended_browsertest.cc
index cae6ecbd80d18c3f758cf9745ae431662dc6e243..608417c083c300103c01a3cbc342c02344e8047c 100644
--- a/chrome/browser/instant/instant_extended_browsertest.cc
+++ b/chrome/browser/instant/instant_extended_browsertest.cc
@@ -148,6 +148,46 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputShowsOverlay) {
EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
}
+// Test that middle clicking on a suggestion opens the result in a new tab.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
+ MiddleClickOnSuggestionOpensInNewTab) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant());
+ FocusOmniboxAndWaitForInstantSupport();
+ EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+
+ // Typing in the omnibox should show the overlay.
+ SetOmniboxTextAndWaitForInstantToShow("santa");
+ EXPECT_TRUE(instant()->IsPreviewingSearchResults());
+
+ // Create an event listener that opens the top suggestion in a new tab.
+ EXPECT_TRUE(ExecuteScript(
+ "var rid = getApiHandle().nativeSuggestions[0].rid;"
+ "document.body.addEventListener('click', function() {"
+ "chrome.embeddedSearch.navigateContentWindow(rid, 2);"
+ "});"
+ ));
+
+ content::WindowedNotificationObserver observer(
+ chrome::NOTIFICATION_TAB_ADDED,
+ content::NotificationService::AllSources());
+
+ // Click to trigger the event listener.
+ ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
+
+ // Wait for the new tab to be added.
+ observer.Wait();
+
+ // Check that the new tab URL is as expected.
+ content::WebContents* new_tab_contents =
+ browser()->tab_strip_model()->GetWebContentsAt(1);
+ EXPECT_EQ(new_tab_contents->GetURL().spec(), instant_url_.spec()+"q=santa");
+
+ // Check that there are now two tabs.
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+}
+
// TODO(sreeram): Enable this test once @mathp's CL lands:
// https://codereview.chromium.org/12179025/
//
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698