| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/search_engines/template_url_service.h" | 5 #include "chrome/browser/search_engines/template_url_service.h" |
| 6 #include "chrome/browser/search_engines/template_url_service_factory.h" | 6 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/base/browser_with_test_window_test.h" | 9 #include "chrome/test/base/browser_with_test_window_test.h" |
| 10 #include "components/search_engines/search_terms_data.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
| 11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 12 | 13 |
| 13 typedef BrowserWithTestWindowTest BookmarkTest; | 14 typedef BrowserWithTestWindowTest BookmarkTest; |
| 14 | 15 |
| 15 // Verify that the detached bookmark bar is visible on the new tab page. | 16 // Verify that the detached bookmark bar is visible on the new tab page. |
| 16 TEST_F(BookmarkTest, DetachedBookmarkBarOnNTP) { | 17 TEST_F(BookmarkTest, DetachedBookmarkBarOnNTP) { |
| 17 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); | 18 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 18 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); | 19 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); |
| 19 } | 20 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 // TemplateURLService is normally NULL during testing. Instant extended | 51 // TemplateURLService is normally NULL during testing. Instant extended |
| 51 // needs this service so set a custom factory function. | 52 // needs this service so set a custom factory function. |
| 52 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 53 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
| 53 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); | 54 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); |
| 54 return profile; | 55 return profile; |
| 55 } | 56 } |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 static KeyedService* CreateTemplateURLService( | 59 static KeyedService* CreateTemplateURLService( |
| 59 content::BrowserContext* profile) { | 60 content::BrowserContext* profile) { |
| 60 return new TemplateURLService(static_cast<Profile*>(profile), NULL, | 61 return new TemplateURLService(static_cast<Profile*>(profile)->GetPrefs(), |
| 61 base::Closure()); | 62 make_scoped_ptr(new SearchTermsData), NULL, |
| 63 scoped_ptr<KeywordHistoryServiceInterface>(), |
| 64 NULL, NULL, base::Closure()); |
| 62 } | 65 } |
| 63 | 66 |
| 64 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); | 67 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 // Verify that in instant extended mode the detached bookmark bar is visible on | 70 // Verify that in instant extended mode the detached bookmark bar is visible on |
| 68 // the new tab page. | 71 // the new tab page. |
| 69 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { | 72 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { |
| 70 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); | 73 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 71 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); | 74 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); |
| 72 } | 75 } |
| OLD | NEW |