OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/search_engines/template_url_service.h" |
| 6 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 7 #include "chrome/browser/ui/search/search.h" |
| 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/base/browser_with_test_window_test.h" |
| 10 |
| 11 typedef BrowserWithTestWindowTest BookmarkTest; |
| 12 |
| 13 // Verify that the detached bookmark bar is visible on the new tab page. |
| 14 TEST_F(BookmarkTest, DetachedBookmarkBarOnNTP) { |
| 15 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 16 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); |
| 17 } |
| 18 |
| 19 class BookmarkInstantExtendedTest : public BrowserWithTestWindowTest { |
| 20 public: |
| 21 BookmarkInstantExtendedTest() { |
| 22 chrome::search::EnableInstantExtendedAPIForTesting(); |
| 23 } |
| 24 |
| 25 protected: |
| 26 virtual TestingProfile* CreateProfile() OVERRIDE { |
| 27 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); |
| 28 // TemplateURLService is normally NULL during testing. Instant extended |
| 29 // needs this service so set a custom factory function. |
| 30 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
| 31 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); |
| 32 return profile; |
| 33 } |
| 34 |
| 35 private: |
| 36 static ProfileKeyedService* CreateTemplateURLService(Profile* profile) { |
| 37 return new TemplateURLService(profile); |
| 38 } |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); |
| 41 }; |
| 42 |
| 43 // Verify that in instant extended mode the detached bookmark bar is visible on |
| 44 // the new tab page. |
| 45 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { |
| 46 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 47 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); |
| 48 } |
OLD | NEW |