| 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 "apps/app_launcher.h" | 7 #include "apps/app_launcher.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual TestingProfile* CreateProfile() OVERRIDE { | 43 virtual TestingProfile* CreateProfile() OVERRIDE { |
| 44 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); | 44 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); |
| 45 // TemplateURLService is normally NULL during testing. Instant extended | 45 // TemplateURLService is normally NULL during testing. Instant extended |
| 46 // needs this service so set a custom factory function. | 46 // needs this service so set a custom factory function. |
| 47 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 47 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
| 48 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); | 48 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); |
| 49 return profile; | 49 return profile; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 static ProfileKeyedService* CreateTemplateURLService( | 53 static BrowserContextKeyedService* CreateTemplateURLService( |
| 54 content::BrowserContext* profile) { | 54 content::BrowserContext* profile) { |
| 55 return new TemplateURLService(static_cast<Profile*>(profile)); | 55 return new TemplateURLService(static_cast<Profile*>(profile)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewInstantExtendedTest); | 58 DISALLOW_COPY_AND_ASSIGN(BookmarkBarViewInstantExtendedTest); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Verify that in instant extended mode the visibility of the apps shortcut | 61 // Verify that in instant extended mode the visibility of the apps shortcut |
| 62 // button properly follows the pref value. | 62 // button properly follows the pref value. |
| 63 TEST_F(BookmarkBarViewInstantExtendedTest, AppsShortcutVisibility) { | 63 TEST_F(BookmarkBarViewInstantExtendedTest, AppsShortcutVisibility) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 78 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); | 78 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); |
| 79 } else { | 79 } else { |
| 80 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); | 80 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Make sure we can also properly transition from true to false. | 83 // Make sure we can also properly transition from true to false. |
| 84 browser()->profile()->GetPrefs()->SetBoolean( | 84 browser()->profile()->GetPrefs()->SetBoolean( |
| 85 prefs::kShowAppsShortcutInBookmarkBar, false); | 85 prefs::kShowAppsShortcutInBookmarkBar, false); |
| 86 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); | 86 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); |
| 87 } | 87 } |
| OLD | NEW |