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

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

Issue 257003004: Remove dependency on bookmark_model_factory from bookmark_test_helpers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@364433
Patch Set: Fix unit tests on Linux & Windows Created 6 years, 7 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
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/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" 9 #include "chrome/browser/bookmarks/bookmark_test_helpers.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 11 #include "chrome/browser/search_engines/template_url_service.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h" 12 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "chrome/browser/ui/app_list/app_list_util.h" 13 #include "chrome/browser/ui/app_list/app_list_util.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 #include "chrome/test/base/browser_with_test_window_test.h" 16 #include "chrome/test/base/browser_with_test_window_test.h"
16 #include "chrome/test/base/scoped_testing_local_state.h" 17 #include "chrome/test/base/scoped_testing_local_state.h"
17 #include "chrome/test/base/testing_browser_process.h" 18 #include "chrome/test/base/testing_browser_process.h"
(...skipping 21 matching lines...) Expand all
39 } 40 }
40 41
41 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewInstantExtendedTest); 42 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewInstantExtendedTest);
42 }; 43 };
43 44
44 // Verify that in instant extended mode the visibility of the apps shortcut 45 // Verify that in instant extended mode the visibility of the apps shortcut
45 // button properly follows the pref value. 46 // button properly follows the pref value.
46 TEST_F(BookmarkBarViewInstantExtendedTest, AppsShortcutVisibility) { 47 TEST_F(BookmarkBarViewInstantExtendedTest, AppsShortcutVisibility) {
47 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal()); 48 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal());
48 profile()->CreateBookmarkModel(true); 49 profile()->CreateBookmarkModel(true);
49 test::WaitForBookmarkModelToLoad(profile()); 50 test::WaitForBookmarkModelToLoad(
51 BookmarkModelFactory::GetForProfile(profile()));
50 BookmarkBarView bookmark_bar_view(browser(), NULL); 52 BookmarkBarView bookmark_bar_view(browser(), NULL);
51 bookmark_bar_view.set_owned_by_client(); 53 bookmark_bar_view.set_owned_by_client();
52 browser()->profile()->GetPrefs()->SetBoolean( 54 browser()->profile()->GetPrefs()->SetBoolean(
53 prefs::kShowAppsShortcutInBookmarkBar, false); 55 prefs::kShowAppsShortcutInBookmarkBar, false);
54 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); 56 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
55 57
56 // Try to make the Apps shortcut visible. Its visibility depends on whether 58 // Try to make the Apps shortcut visible. Its visibility depends on whether
57 // the app launcher is enabled. 59 // the app launcher is enabled.
58 browser()->profile()->GetPrefs()->SetBoolean( 60 browser()->profile()->GetPrefs()->SetBoolean(
59 prefs::kShowAppsShortcutInBookmarkBar, true); 61 prefs::kShowAppsShortcutInBookmarkBar, true);
60 if (IsAppLauncherEnabled()) { 62 if (IsAppLauncherEnabled()) {
61 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); 63 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
62 } else { 64 } else {
63 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); 65 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible());
64 } 66 }
65 67
66 // Make sure we can also properly transition from true to false. 68 // Make sure we can also properly transition from true to false.
67 browser()->profile()->GetPrefs()->SetBoolean( 69 browser()->profile()->GetPrefs()->SetBoolean(
68 prefs::kShowAppsShortcutInBookmarkBar, false); 70 prefs::kShowAppsShortcutInBookmarkBar, false);
69 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); 71 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible());
70 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698