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

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

Issue 12047107: Change the SearchBox API from using the start/end margins of the location bar to using the start ma… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 7 years, 10 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
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 803122a7f61512109e2f7d42ec0eb978108d13f0..f6ca80755428a2e9f8b913bb25e0fcc058c46731 100644
--- a/chrome/browser/instant/instant_extended_browsertest.cc
+++ b/chrome/browser/instant/instant_extended_browsertest.cc
@@ -2,15 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/prefs/pref_service.h"
#include "chrome/browser/instant/instant_commit_type.h"
#include "chrome/browser/instant/instant_ntp.h"
#include "chrome/browser/instant/instant_overlay.h"
#include "chrome/browser/instant/instant_service.h"
#include "chrome/browser/instant/instant_service_factory.h"
#include "chrome/browser/instant/instant_test_utils.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/search/search.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -410,3 +413,32 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ProcessIsolation) {
EXPECT_FALSE(instant_service->IsInstantProcess(
active_tab->GetRenderProcessHost()->GetID()));
}
+
+// Check that toggling the state of the home button changes the start-edge
+// margin and width.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, HomeButtonAffectsMargin) {
+ ASSERT_NO_FATAL_FAILURE(SetupInstant());
+
+ // Get the current value of the start-edge margin and width.
+ int start_margin;
+ int width;
+ content::WebContents* preview_tab = instant()->GetPreviewContents();
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
+ &start_margin));
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &width));
+
+ // Toggle the home button visibility pref.
+ PrefService* profile_prefs = browser()->profile()->GetPrefs();
+ bool show_home = profile_prefs->GetBoolean(prefs::kShowHomeButton);
+ profile_prefs->SetBoolean(prefs::kShowHomeButton, !show_home);
+
+ // Make sure the margin and width changed.
+ int new_start_margin;
+ int new_width;
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
+ &new_start_margin));
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &new_width));
+ EXPECT_NE(start_margin, new_start_margin);
+ EXPECT_NE(width, new_width);
+ EXPECT_EQ(new_width - width, start_margin - new_start_margin);
+}

Powered by Google App Engine
This is Rietveld 408576698