OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h" | 24 #include "chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/test/base/browser_with_test_window_test.h" | 26 #include "chrome/test/base/browser_with_test_window_test.h" |
27 #include "chrome/test/base/menu_model_test.h" | 27 #include "chrome/test/base/menu_model_test.h" |
28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
29 #include "components/sessions/core/persistent_tab_restore_service.h" | 29 #include "components/sessions/core/persistent_tab_restore_service.h" |
30 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" | 30 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" |
31 #include "components/sessions/core/session_types.h" | 31 #include "components/sessions/core/session_types.h" |
32 #include "components/sync_driver/glue/synced_session.h" | 32 #include "components/sync_driver/glue/synced_session.h" |
33 #include "components/sync_driver/local_device_info_provider_mock.h" | 33 #include "components/sync_driver/local_device_info_provider_mock.h" |
| 34 #include "components/sync_driver/sync_client.h" |
34 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/test/test_utils.h" | 36 #include "content/public/test/test_utils.h" |
36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
37 #include "sync/api/fake_sync_change_processor.h" | 38 #include "sync/api/fake_sync_change_processor.h" |
38 #include "sync/api/sync_error_factory_mock.h" | 39 #include "sync/api/sync_error_factory_mock.h" |
39 #include "testing/gmock/include/gmock/gmock.h" | 40 #include "testing/gmock/include/gmock/gmock.h" |
40 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 RecentTabsSubMenuModelTest() | 119 RecentTabsSubMenuModelTest() |
119 : sync_service_(&testing_profile_), | 120 : sync_service_(&testing_profile_), |
120 local_device_(new sync_driver::LocalDeviceInfoProviderMock( | 121 local_device_(new sync_driver::LocalDeviceInfoProviderMock( |
121 "RecentTabsSubMenuModelTest", | 122 "RecentTabsSubMenuModelTest", |
122 "Test Machine", | 123 "Test Machine", |
123 "Chromium 10k", | 124 "Chromium 10k", |
124 "Chrome 10k", | 125 "Chrome 10k", |
125 sync_pb::SyncEnums_DeviceType_TYPE_LINUX, | 126 sync_pb::SyncEnums_DeviceType_TYPE_LINUX, |
126 "device_id")) { | 127 "device_id")) { |
127 manager_.reset(new browser_sync::SessionsSyncManager( | 128 manager_.reset(new browser_sync::SessionsSyncManager( |
| 129 sync_service_.GetSyncClient()->GetSyncSessionsClient(), |
128 &testing_profile_, local_device_.get(), | 130 &testing_profile_, local_device_.get(), |
129 scoped_ptr<browser_sync::LocalSessionEventRouter>(new DummyRouter()), | 131 scoped_ptr<browser_sync::LocalSessionEventRouter>(new DummyRouter()))); |
130 scoped_ptr<browser_sync::SyncedWindowDelegatesGetter>( | |
131 new browser_sync::BrowserSyncedWindowDelegatesGetter()))); | |
132 manager_->MergeDataAndStartSyncing( | 132 manager_->MergeDataAndStartSyncing( |
133 syncer::SESSIONS, | 133 syncer::SESSIONS, |
134 syncer::SyncDataList(), | 134 syncer::SyncDataList(), |
135 scoped_ptr<syncer::SyncChangeProcessor>( | 135 scoped_ptr<syncer::SyncChangeProcessor>( |
136 new syncer::FakeSyncChangeProcessor), | 136 new syncer::FakeSyncChangeProcessor), |
137 scoped_ptr<syncer::SyncErrorFactory>( | 137 scoped_ptr<syncer::SyncErrorFactory>( |
138 new syncer::SyncErrorFactoryMock)); | 138 new syncer::SyncErrorFactoryMock)); |
139 } | 139 } |
140 | 140 |
141 void WaitForLoadFromLastSession() { | 141 void WaitForLoadFromLastSession() { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // 2 Recently closed heaer (disabled) | 594 // 2 Recently closed heaer (disabled) |
595 // 3 <separator> | 595 // 3 <separator> |
596 // 4 No tabs from other Devices | 596 // 4 No tabs from other Devices |
597 | 597 |
598 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); | 598 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); |
599 EXPECT_EQ(5, model.GetItemCount()); | 599 EXPECT_EQ(5, model.GetItemCount()); |
600 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); | 600 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); |
601 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(3)); | 601 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(3)); |
602 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(4)); | 602 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(4)); |
603 } | 603 } |
OLD | NEW |