| 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/search.h" | 5 #include "chrome/browser/search/search.h" |
| 6 #include "chrome/browser/search_engines/template_url_service.h" | 6 #include "chrome/browser/search_engines/template_url_service.h" |
| 7 #include "chrome/browser/search_engines/template_url_service_factory.h" | 7 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/base/browser_with_test_window_test.h" | 10 #include "chrome/test/base/browser_with_test_window_test.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Verify that the detached bookmark bar is hidden. | 36 // Verify that the detached bookmark bar is hidden. |
| 37 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); | 37 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); |
| 38 browser()->tab_strip_model()->AppendWebContents(web_contents, true); | 38 browser()->tab_strip_model()->AppendWebContents(web_contents, true); |
| 39 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); | 39 EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 class BookmarkInstantExtendedTest : public BrowserWithTestWindowTest { | 42 class BookmarkInstantExtendedTest : public BrowserWithTestWindowTest { |
| 43 public: | 43 public: |
| 44 BookmarkInstantExtendedTest() { | 44 BookmarkInstantExtendedTest() { |
| 45 chrome::EnableInstantExtendedAPIForTesting(); | |
| 46 } | 45 } |
| 47 | 46 |
| 48 protected: | 47 protected: |
| 49 virtual TestingProfile* CreateProfile() OVERRIDE { | 48 virtual TestingProfile* CreateProfile() OVERRIDE { |
| 50 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); | 49 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); |
| 51 // TemplateURLService is normally NULL during testing. Instant extended | 50 // TemplateURLService is normally NULL during testing. Instant extended |
| 52 // needs this service so set a custom factory function. | 51 // needs this service so set a custom factory function. |
| 53 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 52 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
| 54 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); | 53 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); |
| 55 return profile; | 54 return profile; |
| 56 } | 55 } |
| 57 | 56 |
| 58 private: | 57 private: |
| 59 static BrowserContextKeyedService* CreateTemplateURLService( | 58 static BrowserContextKeyedService* CreateTemplateURLService( |
| 60 content::BrowserContext* profile) { | 59 content::BrowserContext* profile) { |
| 61 return new TemplateURLService(static_cast<Profile*>(profile)); | 60 return new TemplateURLService(static_cast<Profile*>(profile)); |
| 62 } | 61 } |
| 63 | 62 |
| 64 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); | 63 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 // Verify that in instant extended mode the detached bookmark bar is visible on | 66 // Verify that in instant extended mode the detached bookmark bar is visible on |
| 68 // the new tab page. | 67 // the new tab page. |
| 69 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { | 68 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { |
| 70 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); | 69 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 71 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); | 70 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); |
| 72 } | 71 } |
| OLD | NEW |