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 "chrome/browser/bookmarks/bookmark_test_helpers.h" | 8 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search/search.h" | |
11 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
12 #include "chrome/browser/search_engines/template_url_service_factory.h" | 11 #include "chrome/browser/search_engines/template_url_service_factory.h" |
13 #include "chrome/browser/ui/app_list/app_list_util.h" | 12 #include "chrome/browser/ui/app_list/app_list_util.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 class BookmarkBarViewInstantExtendedTest : public BrowserWithTestWindowTest { | 20 class BookmarkBarViewInstantExtendedTest : public BrowserWithTestWindowTest { |
22 public: | 21 public: |
23 BookmarkBarViewInstantExtendedTest() { | 22 BookmarkBarViewInstantExtendedTest() { |
24 chrome::EnableInstantExtendedAPIForTesting(); | |
25 } | 23 } |
26 | 24 |
27 protected: | 25 protected: |
28 virtual TestingProfile* CreateProfile() OVERRIDE { | 26 virtual TestingProfile* CreateProfile() OVERRIDE { |
29 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); | 27 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); |
30 // TemplateURLService is normally NULL during testing. Instant extended | 28 // TemplateURLService is normally NULL during testing. Instant extended |
31 // needs this service so set a custom factory function. | 29 // needs this service so set a custom factory function. |
32 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 30 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
33 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); | 31 profile, &BookmarkBarViewInstantExtendedTest::CreateTemplateURLService); |
34 return profile; | 32 return profile; |
(...skipping 28 matching lines...) Expand all Loading... |
63 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); | 61 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); |
64 } else { | 62 } else { |
65 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); | 63 EXPECT_TRUE(bookmark_bar_view.apps_page_shortcut_->visible()); |
66 } | 64 } |
67 | 65 |
68 // Make sure we can also properly transition from true to false. | 66 // Make sure we can also properly transition from true to false. |
69 browser()->profile()->GetPrefs()->SetBoolean( | 67 browser()->profile()->GetPrefs()->SetBoolean( |
70 prefs::kShowAppsShortcutInBookmarkBar, false); | 68 prefs::kShowAppsShortcutInBookmarkBar, false); |
71 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); | 69 EXPECT_FALSE(bookmark_bar_view.apps_page_shortcut_->visible()); |
72 } | 70 } |
OLD | NEW |