| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |