| 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 <memory> |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/ptr_util.h" |
| 7 #include "chrome/browser/search_engines/template_url_service_factory.h" | 9 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/base/browser_with_test_window_test.h" | 12 #include "chrome/test/base/browser_with_test_window_test.h" |
| 11 #include "components/search_engines/search_terms_data.h" | 13 #include "components/search_engines/search_terms_data.h" |
| 12 #include "components/search_engines/template_url_service.h" | 14 #include "components/search_engines/template_url_service.h" |
| 13 #include "components/search_engines/template_url_service_client.h" | 15 #include "components/search_engines/template_url_service_client.h" |
| 14 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 15 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 16 | 18 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 TestingProfile* CreateProfile() override { | 54 TestingProfile* CreateProfile() override { |
| 53 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); | 55 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); |
| 54 // TemplateURLService is normally NULL during testing. Instant extended | 56 // TemplateURLService is normally NULL during testing. Instant extended |
| 55 // needs this service so set a custom factory function. | 57 // needs this service so set a custom factory function. |
| 56 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 58 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
| 57 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); | 59 profile, &BookmarkInstantExtendedTest::CreateTemplateURLService); |
| 58 return profile; | 60 return profile; |
| 59 } | 61 } |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 static scoped_ptr<KeyedService> CreateTemplateURLService( | 64 static std::unique_ptr<KeyedService> CreateTemplateURLService( |
| 63 content::BrowserContext* profile) { | 65 content::BrowserContext* profile) { |
| 64 return make_scoped_ptr(new TemplateURLService( | 66 return base::WrapUnique( |
| 65 static_cast<Profile*>(profile)->GetPrefs(), | 67 new TemplateURLService(static_cast<Profile*>(profile)->GetPrefs(), |
| 66 make_scoped_ptr(new SearchTermsData), NULL, | 68 base::WrapUnique(new SearchTermsData), NULL, |
| 67 scoped_ptr<TemplateURLServiceClient>(), NULL, NULL, base::Closure())); | 69 std::unique_ptr<TemplateURLServiceClient>(), |
| 70 NULL, NULL, base::Closure())); |
| 68 } | 71 } |
| 69 | 72 |
| 70 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); | 73 DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest); |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 // Verify that in instant extended mode the detached bookmark bar is visible on | 76 // Verify that in instant extended mode the detached bookmark bar is visible on |
| 74 // the new tab page. | 77 // the new tab page. |
| 75 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { | 78 TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) { |
| 76 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); | 79 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 77 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); | 80 EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state()); |
| 78 } | 81 } |
| OLD | NEW |