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 6defb4b8d8511ffebdd762b4b664b3f877fbd4d0..6163a7ea937326cf60aceadff7735b347f074da7 100644 |
--- a/chrome/browser/instant/instant_extended_browsertest.cc |
+++ b/chrome/browser/instant/instant_extended_browsertest.cc |
@@ -33,6 +33,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) { |
@@ -150,9 +156,9 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxTextUponFocusLostCommit) { |
EXPECT_EQ(ASCIIToUTF16(""), omnibox()->GetInstantSuggestion()); |
} |
-// 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, NavigateSuggestionsWithArrowKeys) { |
+ // This test simulates a search provider using the InstantExtended API to |
+ // navigate through the suggested results and back to the original user query. |
ASSERT_NO_FATAL_FAILURE(SetupInstant()); |
FocusOmniboxAndWaitForInstantSupport(); |
@@ -168,3 +174,21 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsWithArrowKeys) { |
SendUpArrow(); |
EXPECT_EQ("hello", GetOmniboxText()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, NavigateSuggestionsAndHitEscape) { |
+ // 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. |
+ 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()); |
+} |