| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/pinned_tab_service.h" | 5 #include "chrome/browser/ui/tabs/pinned_tab_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 15 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
| 16 #include "chrome/browser/ui/tabs/pinned_tab_service_factory.h" | 16 #include "chrome/browser/ui/tabs/pinned_tab_service_factory.h" |
| 17 #include "chrome/browser/ui/tabs/pinned_tab_test_utils.h" | 17 #include "chrome/browser/ui/tabs/pinned_tab_test_utils.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "chrome/test/base/browser_with_test_window_test.h" | 19 #include "chrome/test/base/browser_with_test_window_test.h" |
| 20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 std::unique_ptr<KeyedService> BuildPinnedTabService( | 25 std::unique_ptr<KeyedService> BuildPinnedTabService( |
| 26 content::BrowserContext* profile) { | 26 content::BrowserContext* profile) { |
| 27 return base::WrapUnique(new PinnedTabService(static_cast<Profile*>(profile))); | 27 return base::MakeUnique<PinnedTabService>(static_cast<Profile*>(profile)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 PinnedTabService* BuildForProfile(Profile* profile) { | 30 PinnedTabService* BuildForProfile(Profile* profile) { |
| 31 return static_cast<PinnedTabService*>( | 31 return static_cast<PinnedTabService*>( |
| 32 PinnedTabServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 32 PinnedTabServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 33 profile, BuildPinnedTabService)); | 33 profile, BuildPinnedTabService)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 class PinnedTabServiceTest : public BrowserWithTestWindowTest { | 36 class PinnedTabServiceTest : public BrowserWithTestWindowTest { |
| 37 public: | 37 public: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 popup->tab_strip_model()->CloseAllTabs(); | 73 popup->tab_strip_model()->CloseAllTabs(); |
| 74 popup.reset(NULL); | 74 popup.reset(NULL); |
| 75 | 75 |
| 76 // Check the state to make sure it hasn't changed. | 76 // Check the state to make sure it hasn't changed. |
| 77 result = PinnedTabTestUtils::TabsToString( | 77 result = PinnedTabTestUtils::TabsToString( |
| 78 PinnedTabCodec::ReadPinnedTabs(profile())); | 78 PinnedTabCodec::ReadPinnedTabs(profile())); |
| 79 EXPECT_EQ("http://www.google.com/:pinned", result); | 79 EXPECT_EQ("http://www.google.com/:pinned", result); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| OLD | NEW |