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

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

Issue 6363001: Makes chrome pass down the length of text as the end of the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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_loader.cc » ('j') | chrome/browser/instant/instant_loader.cc » ('J')
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 2409068ac7e5361a93d814edbdf3dbab638e21c0..154c3e23481a91ad706b167b7e25fe103dd7dcba 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -105,8 +105,8 @@ class InstantTest : public InProcessBrowserTest {
// When the page loads, the initial searchBox values are set and only a
// resize will have been sent.
- ASSERT_EQ("true 0 0 0 1 a false a false",
- GetSearchStateAsString(preview_));
+ ASSERT_EQ("true 0 0 0 1 a false a false 1",
+ GetSearchStateAsString(preview_));
}
void SetLocationBarText(const std::wstring& text) {
@@ -177,6 +177,7 @@ class InstantTest : public InProcessBrowserTest {
// window.beforeLoadSearchBox.verbatim
// window.chrome.searchBox.value
// window.chrome.searchBox.verbatim
+ // window.chrome.searchBox.selectionStart
tonyg 2011/01/14 18:53:27 Optional: I recommend also testing selectionEnd (e
// If determining any of the values fails, the value is 'fail'.
std::string GetSearchStateAsString(TabContents* tab_contents) {
bool sv = false;
@@ -184,6 +185,7 @@ class InstantTest : public InProcessBrowserTest {
int oncancelcalls = 0;
int onchangecalls = 0;
int onresizecalls = 0;
+ int selection_start = 0;
std::string before_load_value;
bool before_load_verbatim = false;
std::string value;
@@ -207,11 +209,14 @@ class InstantTest : public InProcessBrowserTest {
!GetStringFromJavascript(tab_contents, "window.chrome.searchBox.value",
&value) ||
!GetBoolFromJavascript(tab_contents, "window.chrome.searchBox.verbatim",
- &verbatim)) {
+ &verbatim) ||
+ !GetIntFromJavascript(tab_contents,
+ "window.chrome.searchBox.selectionStart",
+ &selection_start)) {
return "fail";
}
- return StringPrintf("%s %d %d %d %d %s %s %s %s",
+ return StringPrintf("%s %d %d %d %d %s %s %s %s %d",
sv ? "true" : "false",
onsubmitcalls,
oncancelcalls,
@@ -220,7 +225,8 @@ class InstantTest : public InProcessBrowserTest {
before_load_value.c_str(),
before_load_verbatim ? "true" : "false",
value.c_str(),
- verbatim ? "true" : "false");
+ verbatim ? "true" : "false",
+ selection_start);
}
void CheckStringValueFromJavascript(
@@ -281,7 +287,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnChangeEvent) {
ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc"));
// Check that the value is reflected and onchange is called.
- EXPECT_EQ("true 0 0 1 1 a false abc false",
+ EXPECT_EQ("true 0 0 1 1 a false abc false 3",
GetSearchStateAsString(preview_));
}
@@ -589,7 +595,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) {
ASSERT_TRUE(contents);
// Check that the value is reflected and onsubmit is called.
- EXPECT_EQ("true 1 0 1 1 a false abc true",
+ EXPECT_EQ("true 1 0 1 1 a false abc true 3",
GetSearchStateAsString(preview_));
}
@@ -613,7 +619,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnCancelEvent) {
ASSERT_TRUE(contents);
// Check that the value is reflected and oncancel is called.
- EXPECT_EQ("true 0 1 1 1 a false abc false",
+ EXPECT_EQ("true 0 1 1 1 a false abc false 3",
GetSearchStateAsString(preview_));
}
@@ -638,7 +644,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) {
ASSERT_EQ(L"abcdef", location_bar_->location_entry()->GetText());
- EXPECT_EQ("true 0 0 2 2 a false abcdef false",
+ EXPECT_EQ("true 0 0 2 2 a false abcdef false 6",
GetSearchStateAsString(preview_));
// Pressing tab again to accept the current instant preview.
@@ -651,6 +657,6 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) {
ASSERT_TRUE(contents);
// Check that the value is reflected and onsubmit is called.
- EXPECT_EQ("true 1 0 2 2 a false abcdef true",
+ EXPECT_EQ("true 1 0 2 2 a false abcdef true 6",
GetSearchStateAsString(preview_));
}
« no previous file with comments | « no previous file | chrome/browser/instant/instant_loader.cc » ('j') | chrome/browser/instant/instant_loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698