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 "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 "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // TemplateURLService is normally NULL during testing. Instant extended | 31 // TemplateURLService is normally NULL during testing. Instant extended |
32 // needs this service so set a custom factory function. | 32 // needs this service so set a custom factory function. |
33 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 33 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
34 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); | 34 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); |
35 return profile; | 35 return profile; |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 static KeyedService* CreateTemplateURLService( | 39 static KeyedService* CreateTemplateURLService( |
40 content::BrowserContext* profile) { | 40 content::BrowserContext* profile) { |
41 return new TemplateURLService(static_cast<Profile*>(profile), NULL); | 41 return new TemplateURLService(static_cast<Profile*>(profile), NULL, |
| 42 base::Closure()); |
42 } | 43 } |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewInstantExtendedTest); | 45 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewInstantExtendedTest); |
45 }; | 46 }; |
46 | 47 |
47 // Verify that in instant extended mode the visibility of the apps shortcut | 48 // Verify that in instant extended mode the visibility of the apps shortcut |
48 // button properly follows the pref value. | 49 // button properly follows the pref value. |
49 TEST_F(BookmarkBarViewInstantExtendedTest, AppsShortcutVisibility) { | 50 TEST_F(BookmarkBarViewInstantExtendedTest, AppsShortcutVisibility) { |
50 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal()); | 51 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal()); |
51 profile()->CreateBookmarkModel(true); | 52 profile()->CreateBookmarkModel(true); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar, | 97 prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar, |
97 new base::FundamentalValue(false)); | 98 new base::FundamentalValue(false)); |
98 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); | 99 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); |
99 | 100 |
100 // And try showing it via policy too. | 101 // And try showing it via policy too. |
101 prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar, | 102 prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar, |
102 new base::FundamentalValue(true)); | 103 new base::FundamentalValue(true)); |
103 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); | 104 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); |
104 } | 105 } |
105 #endif | 106 #endif |
OLD | NEW |