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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 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
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 "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/apps/app_launcher_util.h" 8 #include "chrome/browser/apps/app_launcher_util.h"
9 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" 9 #include "chrome/browser/bookmarks/bookmark_test_helpers.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search/search.h"
12 #include "chrome/browser/search_engines/template_url_service.h" 11 #include "chrome/browser/search_engines/template_url_service.h"
13 #include "chrome/browser/search_engines/template_url_service_factory.h" 12 #include "chrome/browser/search_engines/template_url_service_factory.h"
14 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
15 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/browser_with_test_window_test.h" 15 #include "chrome/test/base/browser_with_test_window_test.h"
17 #include "chrome/test/base/scoped_testing_local_state.h" 16 #include "chrome/test/base/scoped_testing_local_state.h"
18 #include "chrome/test/base/testing_browser_process.h" 17 #include "chrome/test/base/testing_browser_process.h"
19 #include "ui/views/controls/button/text_button.h" 18 #include "ui/views/controls/button/text_button.h"
20 19
21 typedef BrowserWithTestWindowTest BookmarkBarViewTest;
22
23 // Verify that the apps shortcut is never visible without instant extended.
24 TEST_F(BookmarkBarViewTest, NoAppsShortcutWithoutInstantExtended) {
25 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal());
26 profile()->CreateBookmarkModel(true);
27 test::WaitForBookmarkModelToLoad(profile());
28 BookmarkBarView bookmark_bar_view(browser(), NULL);
29 bookmark_bar_view.set_owned_by_client();
30 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
31 browser()->profile()->GetPrefs()->SetBoolean(
32 prefs::kShowAppsShortcutInBookmarkBar, true);
33 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
34 }
35
36 class BookmarkBarViewInstantExtendedTest : public BrowserWithTestWindowTest { 20 class BookmarkBarViewInstantExtendedTest : public BrowserWithTestWindowTest {
37 public: 21 public:
38 BookmarkBarViewInstantExtendedTest() { 22 BookmarkBarViewInstantExtendedTest() {
39 chrome::EnableInstantExtendedAPIForTesting();
40 } 23 }
41 24
42 protected: 25 protected:
43 virtual TestingProfile* CreateProfile() OVERRIDE { 26 virtual TestingProfile* CreateProfile() OVERRIDE {
44 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); 27 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile();
45 // TemplateURLService is normally NULL during testing. Instant extended 28 // TemplateURLService is normally NULL during testing. Instant extended
46 // needs this service so set a custom factory function. 29 // needs this service so set a custom factory function.
47 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( 30 TemplateURLServiceFactory::GetInstance()->SetTestingFactory(
48 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); 31 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService);
49 return profile; 32 return profile;
(...skipping 28 matching lines...) Expand all
78 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); 61 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
79 } else { 62 } else {
80 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); 63 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible());
81 } 64 }
82 65
83 // Make sure we can also properly transition from true to false. 66 // Make sure we can also properly transition from true to false.
84 browser()->profile()->GetPrefs()->SetBoolean( 67 browser()->profile()->GetPrefs()->SetBoolean(
85 prefs::kShowAppsShortcutInBookmarkBar, false); 68 prefs::kShowAppsShortcutInBookmarkBar, false);
86 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); 69 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
87 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698