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

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: Don't run test on Mac & Linux 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
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_page.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f0fc5143f6ea1b30c30654f6499c7fe5f927ff19..9e03d54829e20a1b9cec737651d470a33ee1b5f3 100644
--- a/chrome/browser/instant/instant_extended_browsertest.cc
+++ b/chrome/browser/instant/instant_extended_browsertest.cc
@@ -4,6 +4,7 @@
#include <sstream>
+#include "base/prefs/pref_service.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/browser/instant/instant_commit_type.h"
#include "chrome/browser/instant/instant_ntp.h"
@@ -12,9 +13,11 @@
#include "chrome/browser/instant/instant_service_factory.h"
#include "chrome/browser/instant/instant_tab.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"
@@ -718,3 +721,38 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MostVisited) {
// Make sure we have the same number of items as before.
EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count);
}
+
+// Only implemented in Views currently: http://crbug.com/164723
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
+#define MAYBE_HomeButtonAffectsMargin HomeButtonAffectsMargin
+#else
+#define MAYBE_HomeButtonAffectsMargin DISABLED_HomeButtonAffectsMargin
+#endif
+// Check that toggling the state of the home button changes the start-edge
+// margin and width.
+IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_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);
+}
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698