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

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: Added test 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 08f8b4d094579c90ea12e3e047faf8820e4c4b55..871c0cf419724c9622d5fc115f602d395f6e820f 100644
--- a/chrome/browser/instant/instant_extended_browsertest.cc
+++ b/chrome/browser/instant/instant_extended_browsertest.cc
@@ -4,7 +4,10 @@
#include "chrome/browser/instant/instant_loader.h"
#include "chrome/browser/instant/instant_test_utils.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/search/search.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -80,3 +83,31 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputShowsOverlay) {
EXPECT_TRUE(instant()->model()->mode().is_search_suggestions());
EXPECT_EQ(preview_tab, instant()->GetPreviewContents());
}
+
+// 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 startMargin;
+ int width;
+ content::WebContents* preview_tab = instant()->GetPreviewContents();
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
+ &startMargin));
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &width));
+
+ // Toggle the home button visibility pref.
+ PrefService* profile_prefs = browser()->profile()->GetPrefs();
+ bool showHome = profile_prefs->GetBoolean(prefs::kShowHomeButton);
+ profile_prefs->SetBoolean(prefs::kShowHomeButton, !showHome);
+
+ // Make sure the margin and width changed.
+ int newStartMargin;
+ int newWidth;
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
+ &newStartMargin));
+ EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &newWidth));
+ EXPECT_NE(startMargin, newStartMargin);
+ EXPECT_NE(width, newWidth);
samarth 2013/02/07 00:28:37 Is it always the case that the deltas between the
melevin 2013/02/07 21:21:23 Ah good point, that should be true.
+}

Powered by Google App Engine
This is Rietveld 408576698