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 33195fc87f0dd666663ae9343beea3d648726f7b..dabbaf6915b26ef557722bb21a8c5918f38a07d3 100644 |
--- a/chrome/browser/instant/instant_extended_browsertest.cc |
+++ b/chrome/browser/instant/instant_extended_browsertest.cc |
@@ -54,6 +54,12 @@ class InstantExtendedTest : public InstantTestBase { |
// Wait for JavaScript to run the key handler by executing a blank script. |
EXPECT_TRUE(ExecuteScript(std::string())); |
} |
+ |
+ void SendEscape() { |
+ omnibox()->model()->OnEscapeKeyPressed(); |
+ // Wait for JavaScript to run the key handler by executing a blank script. |
+ EXPECT_TRUE(ExecuteScript(std::string())); |
+ } |
}; |
IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ExtendedModeIsOn) { |
@@ -341,3 +347,21 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ProcessIsolation) { |
EXPECT_FALSE(instant_service->IsInstantProcess( |
active_tab->GetRenderProcessHost()->GetID())); |
} |
+ |
+// 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. |
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsAndHitEscape) { |
+ ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
+ FocusOmniboxAndWaitForInstantSupport(); |
+ |
+ SetOmniboxTextAndWaitForInstantToShow("hello"); |
+ EXPECT_EQ("hello", GetOmniboxText()); |
+ |
+ SendDownArrow(); |
+ EXPECT_EQ("result 1", GetOmniboxText()); |
+ SendDownArrow(); |
+ EXPECT_EQ("result 2", GetOmniboxText()); |
+ SendEscape(); |
+ EXPECT_EQ("hello", GetOmniboxText()); |
+} |