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

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

Issue 5697003: Fixes bug in instant where we wouldn't initially tell the page the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update test for new API Created 10 years 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 0ef841032d31b1d8522e1d2f056ea07b077b1e0f..f362158d8662849d4659af10ac2bf029c4eabdb2 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -83,8 +83,8 @@ class InstantTest : public InProcessBrowserTest {
EXPECT_TRUE(browser()->instant()->IsShowingInstant());
EXPECT_FALSE(browser()->instant()->is_active());
- // When the page loads, the initial searchBox values are set and no events
- // have been called.
+ // When the page loads, the initial searchBox values are set and only a
+ // resize will have been sent.
EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript(
true, "window.chrome.sv", preview_));
EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript(
@@ -94,7 +94,7 @@ class InstantTest : public InProcessBrowserTest {
EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript(
0, "window.onchangecalls", preview_));
EXPECT_NO_FATAL_FAILURE(CheckIntValueFromJavascript(
- 0, "window.onresizecalls", preview_));
+ 1, "window.onresizecalls", preview_));
EXPECT_NO_FATAL_FAILURE(CheckStringValueFromJavascript(
"a", "window.chrome.searchBox.value", preview_));
EXPECT_NO_FATAL_FAILURE(CheckBoolValueFromJavascript(
@@ -244,6 +244,29 @@ IN_PROC_BROWSER_TEST_F(InstantTest,
EXPECT_FALSE(browser()->instant()->is_active());
}
+// Verifies the page was told a non-zero height.
+// TODO: when we nuke the old api and fix 66104, this test should load
+// search.html.
+IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) {
+ ASSERT_TRUE(test_server()->Start());
+ ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("old_api.html"));
+ ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"a"));
+ // The preview should be active.
+ ASSERT_TRUE(browser()->instant()->is_active());
+ // And the height should be valid.
+ TabContents* tab = browser()->instant()->GetPreviewContents()->tab_contents();
+ ASSERT_NO_FATAL_FAILURE(
+ CheckBoolValueFromJavascript(true, "window.validHeight", tab));
+
+ // Check that searchbox height was also set.
+ std::wstring script =
+ L"window.domAutomationController.send(window.chrome.searchBox.height)";
+ int height;
+ ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt(
+ tab->render_view_host(), std::wstring(), script, &height));
+ EXPECT_GT(height, 0);
+}
+
// Verify that the onsubmit event is dispatched upon pressing enter.
// TODO(sky): Disabled, http://crbug.com/62940.
IN_PROC_BROWSER_TEST_F(InstantTest, DISABLED_OnSubmitEvent) {
« 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