Chromium Code Reviews| 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 08f8b4d094579c90ea12e3e047faf8820e4c4b55..52a9b3e1fb8ca6cb52a900d52432051cb5de1b9c 100644 |
| --- a/chrome/browser/instant/instant_extended_browsertest.cc |
| +++ b/chrome/browser/instant/instant_extended_browsertest.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/instant/instant_loader.h" |
| #include "chrome/browser/instant/instant_test_utils.h" |
| #include "chrome/browser/ui/search/search.h" |
| +#include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/test/base/interactive_test_utils.h" |
| #include "chrome/test/base/ui_test_utils.h" |
| @@ -80,3 +81,32 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputShowsOverlay) { |
| EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); |
| 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(); |
| + |
| + ASSERT_TRUE(browser()->tab_strip_model()->count() == 1); |
|
sreeram
2013/02/06 22:00:50
I'd just make this an EXPECT. Generally we use ASS
dougw
2013/02/20 21:46:56
Done.
|
| + |
| + // Typing in the omnibox should show the overlay. |
| + SetOmniboxTextAndWaitForInstantToShow("test"); |
| + EXPECT_TRUE(instant()->model()->mode().is_search_suggestions()); |
| + |
| + EXPECT_TRUE(ExecuteScript("function Click() {" |
| + "var eventObject = document.createEvent('MouseEvents');" |
| + "eventObject.initMouseEvent('click');" |
| + "document.getElementsByTagName('body')[0].dispatchEvent(eventObject);" |
| + "}" |
| + "document.body.addEventListener(\"click\", function() {" |
| + "var nativeSuggestions = chrome.searchBox.nativeSuggestions;" |
| + "if (nativeSuggestions.length > 0) {" |
| + "chrome.searchBox.navigateContentWindow(nativeSuggestions[0].rid, 2);" |
|
sreeram
2013/02/06 22:00:50
I recommend that you navigate to a known URL, such
dougw
2013/02/20 21:46:56
Done.
|
| + "}" |
| + "});" |
| + "Click();")); |
|
sreeram
2013/02/06 22:00:50
Why not actually click on the page using ui_test_u
dougw
2013/02/20 21:46:56
Done.
|
| + |
| + // Check that there are now two tabs. |
| + EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
| +} |