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

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: The Great Samarth Merge of 2013 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 33195fc87f0dd666663ae9343beea3d648726f7b..05f329b8ead3192e00219a106327a28ea5ed3089 100644
--- a/chrome/browser/instant/instant_extended_browsertest.cc
+++ b/chrome/browser/instant/instant_extended_browsertest.cc
@@ -8,9 +8,12 @@
#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/prefs/pref_service.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"
@@ -341,3 +344,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 startMargin;
sreeram 2013/02/14 18:26:57 start_margin
melevin 2013/02/19 22:00:49 Oops, went into JavaScript mode...
+ 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;
sreeram 2013/02/14 18:26:57 new_start_margin new_width
melevin 2013/02/19 22:00:49 Done.
+ 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);
+ EXPECT_EQ(newWidth - width, startMargin - newStartMargin);
+}

Powered by Google App Engine
This is Rietveld 408576698