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

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
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <sstream> 5 #include <sstream>
6 6
7 #include "chrome/browser/instant/instant_commit_type.h" 7 #include "chrome/browser/instant/instant_commit_type.h"
8 #include "chrome/browser/instant/instant_ntp.h" 8 #include "chrome/browser/instant/instant_ntp.h"
9 #include "chrome/browser/instant/instant_overlay.h" 9 #include "chrome/browser/instant/instant_overlay.h"
10 #include "chrome/browser/instant/instant_service.h" 10 #include "chrome/browser/instant/instant_service.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 EXPECT_TRUE(preview_tab); 141 EXPECT_TRUE(preview_tab);
142 EXPECT_FALSE(instant()->IsPreviewingSearchResults()); 142 EXPECT_FALSE(instant()->IsPreviewingSearchResults());
143 EXPECT_TRUE(instant()->model()->mode().is_default()); 143 EXPECT_TRUE(instant()->model()->mode().is_default());
144 144
145 // Typing in the omnibox should show the overlay. 145 // Typing in the omnibox should show the overlay.
146 SetOmniboxTextAndWaitForInstantToShow("query"); 146 SetOmniboxTextAndWaitForInstantToShow("query");
147 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); 147 EXPECT_TRUE(instant()->model()->mode().is_search_suggestions());
148 EXPECT_EQ(preview_tab, instant()->GetPreviewContents()); 148 EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
149 } 149 }
150 150
151 // Test that middle clicking on a suggestion opens the result in a new tab.
152 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
153 MiddleClickOnSuggestionOpensInNewTab) {
154 ASSERT_NO_FATAL_FAILURE(SetupInstant());
155 FocusOmniboxAndWaitForInstantSupport();
156 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
157
158 EXPECT_EQ(1, browser()->tab_strip_model()->count());
159
160 // Typing in the omnibox should show the overlay.
161 SetOmniboxTextAndWaitForInstantToShow("santa");
162 EXPECT_TRUE(instant()->IsPreviewingSearchResults());
163
164 // Create an event listener that opens the top suggestion in a new tab.
165 EXPECT_TRUE(ExecuteScript(
166 "var rid = getApiHandle().nativeSuggestions[0].rid;"
167 "document.body.addEventListener('click', function() {"
168 "chrome.embeddedSearch.navigateContentWindow(rid, 2);"
169 "});"
170 ));
171
172 content::WindowedNotificationObserver observer(
173 chrome::NOTIFICATION_TAB_ADDED,
174 content::NotificationService::AllSources());
175
176 // Click to trigger the event listener.
177 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER);
178
179 // Wait for the new tab to be added.
180 observer.Wait();
181
182 // Check that the new tab URL is as expected.
183 content::WebContents* new_tab_contents =
184 browser()->tab_strip_model()->GetWebContentsAt(1);
185 EXPECT_EQ(new_tab_contents->GetURL().spec(), instant_url_.spec()+"q=santa");
186
187 // Check that there are now two tabs.
188 EXPECT_EQ(2, browser()->tab_strip_model()->count());
189 }
190
151 // TODO(sreeram): Enable this test once @mathp's CL lands: 191 // TODO(sreeram): Enable this test once @mathp's CL lands:
152 // https://codereview.chromium.org/12179025/ 192 // https://codereview.chromium.org/12179025/
153 // 193 //
154 // Test that omnibox text is correctly set when overlay is committed with Enter. 194 // Test that omnibox text is correctly set when overlay is committed with Enter.
155 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, 195 IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
156 DISABLED_OmniboxTextUponEnterCommit) { 196 DISABLED_OmniboxTextUponEnterCommit) {
157 ASSERT_NO_FATAL_FAILURE(SetupInstant()); 197 ASSERT_NO_FATAL_FAILURE(SetupInstant());
158 FocusOmniboxAndWaitForInstantSupport(); 198 FocusOmniboxAndWaitForInstantSupport();
159 199
160 // The page will autocomplete once we set the omnibox value. 200 // The page will autocomplete once we set the omnibox value.
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 stream << "apiHandle.undoAllMostVisitedDeletions()"; 660 stream << "apiHandle.undoAllMostVisitedDeletions()";
621 EXPECT_TRUE(ExecuteScript(stream.str())); 661 EXPECT_TRUE(ExecuteScript(stream.str()));
622 observer.Wait(); 662 observer.Wait();
623 663
624 // Update Most Visited state. 664 // Update Most Visited state.
625 EXPECT_TRUE(UpdateSearchState(preview_tab)); 665 EXPECT_TRUE(UpdateSearchState(preview_tab));
626 666
627 // Make sure we have the same number of items as before. 667 // Make sure we have the same number of items as before.
628 EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count); 668 EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count);
629 } 669 }
OLDNEW
« 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