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

Unified Diff: chrome/browser/instant/instant_browsertest.cc

Issue 10949016: Fix case handling in Instant suggestions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebaseline Created 8 years, 3 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 | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_browsertest.cc
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index 849904dfd9417f565156707deea51e965b0a955b..94478ea9595900a3b75ae66c46b14b939b625eaa 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -79,7 +79,7 @@ class InstantTest : public InProcessBrowserTest {
void SetOmniboxText(const std::string& text) {
FocusOmnibox();
- omnibox()->SetUserText(ASCIIToUTF16(text));
+ omnibox()->SetUserText(UTF8ToUTF16(text));
}
void SetOmniboxTextAndWaitForInstantToShow(const std::string& text) {
@@ -129,7 +129,7 @@ class InstantTest : public InProcessBrowserTest {
bool ExecuteScript(const std::string& script) WARN_UNUSED_RESULT {
return content::ExecuteJavaScript(
instant()->GetPreviewContents()->web_contents()->GetRenderViewHost(),
- std::wstring(), ASCIIToWide(script));
+ std::wstring(), UTF8ToWide(script));
}
bool CheckVisibilityIs(TabContents* tab, bool expected) WARN_UNUSED_RESULT {
@@ -867,3 +867,49 @@ IN_PROC_BROWSER_TEST_F(InstantTest, InstantLoaderRefresh) {
instant()->OnAutocompleteLostFocus(NULL);
EXPECT_FALSE(instant()->loader()->supports_instant());
}
+
+// Test that suggestions are case insensitive. http://crbug.com/150728
+IN_PROC_BROWSER_TEST_F(InstantTest, SuggestionsAreCaseInsensitive) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant("instant.html"));
+ FocusOmniboxAndWaitForInstantSupport();
+
+ EXPECT_TRUE(ExecuteScript("suggestion = [ { value: 'INSTANT' } ]"));
+
+ SetOmniboxTextAndWaitForInstantToShow("in");
+ EXPECT_EQ(ASCIIToUTF16("instant"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow("IN");
+ EXPECT_EQ(ASCIIToUTF16("INSTANT"), omnibox()->GetText());
+
+ // U+0130 == LATIN CAPITAL LETTER I WITH DOT ABOVE
+ EXPECT_TRUE(ExecuteScript("suggestion = [ { value: '\\u0130NSTANT' } ]"));
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow("i");
+ EXPECT_EQ(WideToUTF16(L"i\u0307nstant"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow("I");
+ EXPECT_EQ(WideToUTF16(L"I\u0307nstant"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"i\u0307"));
+ EXPECT_EQ(WideToUTF16(L"i\u0307nstant"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"I\u0307"));
+ EXPECT_EQ(WideToUTF16(L"I\u0307nstant"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow(WideToUTF8(L"\u0130"));
+ EXPECT_EQ(WideToUTF16(L"\u0130NSTANT"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow("in");
+ EXPECT_EQ(ASCIIToUTF16("in"), omnibox()->GetText());
+
+ instant()->Hide();
+ SetOmniboxTextAndWaitForInstantToShow("IN");
+ EXPECT_EQ(ASCIIToUTF16("IN"), omnibox()->GetText());
+}
« no previous file with comments | « no previous file | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698