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/toolbar/recent_tabs_sub_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/sessions/session_types.h" | 8 #include "chrome/browser/sessions/session_types.h" |
9 #include "chrome/browser/sessions/persistent_tab_restore_service.h" | 9 #include "chrome/browser/sessions/persistent_tab_restore_service.h" |
10 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 10 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 class RecentTabsSubMenuModelTest : public BrowserWithTestWindowTest { | 58 class RecentTabsSubMenuModelTest : public BrowserWithTestWindowTest { |
59 public: | 59 public: |
60 RecentTabsSubMenuModelTest() | 60 RecentTabsSubMenuModelTest() |
61 : sync_service_(&testing_profile_), | 61 : sync_service_(&testing_profile_), |
62 associator_(&sync_service_, true) { | 62 associator_(&sync_service_, true) { |
63 associator_.SetCurrentMachineTagForTesting("RecentTabsSubMenuModelTest"); | 63 associator_.SetCurrentMachineTagForTesting("RecentTabsSubMenuModelTest"); |
64 } | 64 } |
65 | 65 |
66 static ProfileKeyedService* GetTabRestoreService( | 66 static BrowserContextKeyedService* GetTabRestoreService( |
67 content::BrowserContext* browser_context) { | 67 content::BrowserContext* browser_context) { |
68 // Ownership is tranfered to the profile. | 68 // Ownership is tranfered to the profile. |
69 return new PersistentTabRestoreService( | 69 return new PersistentTabRestoreService( |
70 Profile::FromBrowserContext(browser_context), NULL);; | 70 Profile::FromBrowserContext(browser_context), NULL);; |
71 } | 71 } |
72 private: | 72 private: |
73 TestingProfile testing_profile_; | 73 TestingProfile testing_profile_; |
74 testing::NiceMock<ProfileSyncServiceMock> sync_service_; | 74 testing::NiceMock<ProfileSyncServiceMock> sync_service_; |
75 | 75 |
76 protected: | 76 protected: |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // 0 Reopen closed tab | 297 // 0 Reopen closed tab |
298 // 1 <separator> | 298 // 1 <separator> |
299 // 2 No tabs from other Devices | 299 // 2 No tabs from other Devices |
300 | 300 |
301 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); | 301 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); |
302 EXPECT_EQ(3, model.GetItemCount()); | 302 EXPECT_EQ(3, model.GetItemCount()); |
303 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); | 303 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); |
304 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); | 304 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); |
305 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); | 305 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); |
306 } | 306 } |
OLD | NEW |