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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/instant/instant_page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "base/prefs/pref_service.h"
7 #include "chrome/browser/favicon/favicon_tab_helper.h" 8 #include "chrome/browser/favicon/favicon_tab_helper.h"
8 #include "chrome/browser/instant/instant_commit_type.h" 9 #include "chrome/browser/instant/instant_commit_type.h"
9 #include "chrome/browser/instant/instant_ntp.h" 10 #include "chrome/browser/instant/instant_ntp.h"
10 #include "chrome/browser/instant/instant_overlay.h" 11 #include "chrome/browser/instant/instant_overlay.h"
11 #include "chrome/browser/instant/instant_service.h" 12 #include "chrome/browser/instant/instant_service.h"
12 #include "chrome/browser/instant/instant_service_factory.h" 13 #include "chrome/browser/instant/instant_service_factory.h"
13 #include "chrome/browser/instant/instant_tab.h" 14 #include "chrome/browser/instant/instant_tab.h"
14 #include "chrome/browser/instant/instant_test_utils.h" 15 #include "chrome/browser/instant/instant_test_utils.h"
16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/search/search.h" 17 #include "chrome/browser/ui/search/search.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
19 #include "chrome/test/base/interactive_test_utils.h" 22 #include "chrome/test/base/interactive_test_utils.h"
20 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/render_process_host.h" 25 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/site_instance.h" 26 #include "content/public/browser/site_instance.h"
24 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
25 #include "content/public/browser/web_contents_view.h" 28 #include "content/public/browser/web_contents_view.h"
26 #include "content/public/test/browser_test_utils.h" 29 #include "content/public/test/browser_test_utils.h"
27 30
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 stream << "newTabPageHandle.undoAllMostVisitedDeletions()"; 714 stream << "newTabPageHandle.undoAllMostVisitedDeletions()";
712 EXPECT_TRUE(ExecuteScript(stream.str())); 715 EXPECT_TRUE(ExecuteScript(stream.str()));
713 observer.Wait(); 716 observer.Wait();
714 717
715 // Update Most Visited state. 718 // Update Most Visited state.
716 EXPECT_TRUE(UpdateSearchState(preview_tab)); 719 EXPECT_TRUE(UpdateSearchState(preview_tab));
717 720
718 // Make sure we have the same number of items as before. 721 // Make sure we have the same number of items as before.
719 EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count); 722 EXPECT_EQ(most_visited_items_count_, old_most_visited_items_count);
720 } 723 }
724
725 // Only implemented in Views currently: http://crbug.com/164723
726 #if defined(OS_WIN) || defined(OS_CHROMEOS)
727 #define MAYBE_HomeButtonAffectsMargin HomeButtonAffectsMargin
728 #else
729 #define MAYBE_HomeButtonAffectsMargin DISABLED_HomeButtonAffectsMargin
730 #endif
731 // Check that toggling the state of the home button changes the start-edge
732 // margin and width.
733 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, MAYBE_HomeButtonAffectsMargin) {
734 ASSERT_NO_FATAL_FAILURE(SetupInstant());
735
736 // Get the current value of the start-edge margin and width.
737 int start_margin;
738 int width;
739 content::WebContents* preview_tab = instant()->GetPreviewContents();
740 EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
741 &start_margin));
742 EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &width));
743
744 // Toggle the home button visibility pref.
745 PrefService* profile_prefs = browser()->profile()->GetPrefs();
746 bool show_home = profile_prefs->GetBoolean(prefs::kShowHomeButton);
747 profile_prefs->SetBoolean(prefs::kShowHomeButton, !show_home);
748
749 // Make sure the margin and width changed.
750 int new_start_margin;
751 int new_width;
752 EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.startMargin",
753 &new_start_margin));
754 EXPECT_TRUE(GetIntFromJS(preview_tab, "chrome.searchBox.width", &new_width));
755 EXPECT_NE(start_margin, new_start_margin);
756 EXPECT_NE(width, new_width);
757 EXPECT_EQ(new_width - width, start_margin - new_start_margin);
758 }
OLDNEW
« 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