| 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 7c5b811130c71d237ceb7a35cec39ddea655e4ba..d6fa8d2a9c3a961fba47d90564a90c09a50ed2c8 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"
|
| @@ -11,9 +12,11 @@
|
| #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"
|
| @@ -694,3 +697,32 @@ 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);
|
| }
|
| +
|
| +// 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);
|
| +}
|
|
|