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