Chromium Code Reviews| 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. |