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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/instant/instant_commit_type.h" 5 #include "chrome/browser/instant/instant_commit_type.h"
6 #include "chrome/browser/instant/instant_ntp.h" 6 #include "chrome/browser/instant/instant_ntp.h"
7 #include "chrome/browser/instant/instant_overlay.h" 7 #include "chrome/browser/instant/instant_overlay.h"
8 #include "chrome/browser/instant/instant_service.h" 8 #include "chrome/browser/instant/instant_service.h"
9 #include "chrome/browser/instant/instant_service_factory.h" 9 #include "chrome/browser/instant/instant_service_factory.h"
10 #include "chrome/browser/instant/instant_test_utils.h" 10 #include "chrome/browser/instant/instant_test_utils.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 EXPECT_TRUE(preview_tab); 120 EXPECT_TRUE(preview_tab);
121 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); 121 EXPECT_FALSE(instant()->IsPreviewingSearchResults());
122 EXPECT_TRUE(instant()->model()->mode().is_default()); 122 EXPECT_TRUE(instant()->model()->mode().is_default());
123 123
124 // Typing in the omnibox should show the overlay. 124 // Typing in the omnibox should show the overlay.
125 SetOmniboxTextAndWaitForInstantToShow("query"); 125 SetOmniboxTextAndWaitForInstantToShow("query");
126 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); 126 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions());
127 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); 127 EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
128 } 128 }
129 129
130 // Test that middle clicking on a suggestion opens the result in a new tab.
131 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
132 MiddleClickOnSuggestionOpensInNewTab) {
133 ASSERT_NO_FATAL_FAILURE(SetupInstant());
134 FocusOmniboxAndWaitForInstantSupport();
135 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
136
137 EXPECT_EQ(1, browser()->tab_strip_model()->count());
138
139 // Typing in the omnibox should show the overlay.
140 SetOmniboxTextAndWaitForInstantToShow("santa");
141 EXPECT_TRUE(instant()->IsPreviewingSearchResults());
142
143 // Create an event listener that opens the top suggestion in a new tab.
144 EXPECT_TRUE(ExecuteScript(
145 "var rid = getApiHandle().nativeSuggestions[0].rid;"
146 "document.body.addEventListener('click', function() {"
147 "chrome.embeddedSearch.navigateContentWindow(rid, 2);"
148 "});"
149 ));
150
151 content::WindowedNotificationObserver observer(
152 chrome::NOTIFICATION_TAB_ADDED,
153 content::NotificationService::AllSources());
154
155 // Click to trigger the event listener.
156 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
157
158 // Wait for the new tab to be added.
159 observer.Wait();
160
161 // Check that the new tab URL is as expected.
162 content::WebContents* new_tab_contents =
163 browser()->tab_strip_model()->GetWebContentsAt(1);
164 EXPECT_EQ(new_tab_contents->GetURL().spec(), instant_url_.spec()+"q=santa");
165
166 // Check that there are now two tabs.
167 EXPECT_EQ(2, browser()->tab_strip_model()->count());
168 }
169
130 // TODO(sreeram): Enable this test once @mathp's CL lands: 170 // TODO(sreeram): Enable this test once @mathp's CL lands:
131 // https://codereview.chromium.org/12179025/ 171 // https://codereview.chromium.org/12179025/
132 // 172 //
133 // Test that omnibox text is correctly set when overlay is committed with Enter. 173 // Test that omnibox text is correctly set when overlay is committed with Enter.
134 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, 174 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
135 DISABLED_OmniboxTextUponEnterCommit) { 175 DISABLED_OmniboxTextUponEnterCommit) {
136 ASSERT_NO_FATAL_FAILURE(SetupInstant()); 176 ASSERT_NO_FATAL_FAILURE(SetupInstant());
137 FocusOmniboxAndWaitForInstantSupport(); 177 FocusOmniboxAndWaitForInstantSupport();
138 178
139 // The page will autocomplete once we set the omnibox value. 179 // The page will autocomplete once we set the omnibox value.
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 browser()->window()->GetLocationBar()->AcceptInput(); 498 browser()->window()->GetLocationBar()->AcceptInput();
459 content::WebContents* second_active_tab = 499 content::WebContents* second_active_tab =
460 browser()->tab_strip_model()->GetActiveWebContents(); 500 browser()->tab_strip_model()->GetActiveWebContents();
461 EXPECT_NE(first_active_tab, second_active_tab); 501 EXPECT_NE(first_active_tab, second_active_tab);
462 scoped_refptr<content::SiteInstance> second_site_instance = 502 scoped_refptr<content::SiteInstance> second_site_instance =
463 second_active_tab->GetSiteInstance(); 503 second_active_tab->GetSiteInstance();
464 EXPECT_NE(first_site_instance, second_site_instance); 504 EXPECT_NE(first_site_instance, second_site_instance);
465 EXPECT_FALSE(first_site_instance->IsRelatedSiteInstance( 505 EXPECT_FALSE(first_site_instance->IsRelatedSiteInstance(
466 second_site_instance)); 506 second_site_instance));
467 } 507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698