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

Unified Diff: chrome/browser/ui/search/instant_extended_browsertest.cc

Issue 12895007: Send onsubmit query down to the instant extended overlay page when a navigation is performed from t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OnSubmit tweak + comment. Created 7 years, 8 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/ui/search/instant_controller.cc ('k') | chrome/renderer/searchbox/searchbox.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_extended_browsertest.cc
diff --git a/chrome/browser/ui/search/instant_extended_browsertest.cc b/chrome/browser/ui/search/instant_extended_browsertest.cc
index 981ce6a0f8bb5ae7dca867f80b7098ae1311a202..e9ead2726872fa9d53285cc1ec31208e85e5a93a 100644
--- a/chrome/browser/ui/search/instant_extended_browsertest.cc
+++ b/chrome/browser/ui/search/instant_extended_browsertest.cc
@@ -448,12 +448,57 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsWithArrowKeys) {
// TODO(beaudoin): Figure out why this fails.
// EXPECT_FALSE(HasTemporaryText());
-
// Commit the search by pressing Enter.
browser()->window()->GetLocationBar()->AcceptInput();
EXPECT_EQ("hello", GetOmniboxText());
}
+
+// This test simulates a search provider using the InstantExtended API to
+// navigate through the suggested results and back to the original user query.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
+ NavigateToURLSuggestionHitEnterAndLookForSubmit) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
+ FocusOmniboxAndWaitForInstantExtendedSupport();
+
+ // Create an observer to wait for the instant tab to support Instant.
+ content::WindowedNotificationObserver observer(
+ chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED,
+ content::NotificationService::AllSources());
+
+ // Do a search and commit it.
+ SetOmniboxTextAndWaitForOverlayToShow("hello k");
+ EXPECT_EQ(ASCIIToUTF16("hello k"), omnibox()->GetText());
+ browser()->window()->GetLocationBar()->AcceptInput();
+ observer.Wait();
+
+ SetOmniboxText("http");
+ EXPECT_EQ("http", GetOmniboxText());
+
+ SendDownArrow();
+ EXPECT_EQ("result 1", GetOmniboxText());
+ SendDownArrow();
+ EXPECT_EQ("result 2", GetOmniboxText());
+ SendDownArrow();
+ EXPECT_EQ("http://www.google.com", GetOmniboxText());
+
+ EXPECT_TRUE(HasUserInputInProgress());
+
+ int submit_count = 0;
+ GetIntFromJS(instant()->instant_tab()->contents(), "submitCount",
+ &submit_count);
+ // Note the commit count is initially 1 due to the AcceptInput() call above.
+ EXPECT_EQ(1, submit_count);
+
+ // Commit the search by pressing Enter.
+ browser()->window()->GetLocationBar()->AcceptInput();
+
+ // Make sure a submit message got sent.
+ GetIntFromJS(instant()->instant_tab()->contents(), "submitCount",
sreeram 2013/04/08 16:20:38 I'm mildly worried that this is brittle. If in the
robertshield 2013/04/09 14:49:29 Maybe. I could examine the IPCs being sent, by sti
sreeram 2013/04/09 16:39:41 Here are some alternatives: 1. Get a handle to th
+ &submit_count);
sreeram 2013/04/08 16:20:38 Use UpdateSearchState() and verify both the submit
+ EXPECT_EQ(2, submit_count);
+}
+
// This test simulates a search provider using the InstantExtended API to
// navigate through the suggested results and hitting escape to get back to the
// original user query.
« no previous file with comments | « chrome/browser/ui/search/instant_controller.cc ('k') | chrome/renderer/searchbox/searchbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698