OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/extensions/api/sessions/sessions_api.h" | 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
11 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
12 #include "chrome/browser/extensions/extension_function_test_utils.h" | 12 #include "chrome/browser/extensions/extension_function_test_utils.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/sync/glue/session_model_associator.h" | 14 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 15 #include "chrome/browser/sync/open_tabs_ui_delegate.h" |
15 #include "chrome/browser/sync/profile_sync_service.h" | 16 #include "chrome/browser/sync/profile_sync_service.h" |
16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" |
17 #include "chrome/browser/sync/profile_sync_service_mock.h" | 18 #include "chrome/browser/sync/profile_sync_service_mock.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
20 #include "chrome/test/base/test_switches.h" | 21 #include "chrome/test/base/test_switches.h" |
21 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
22 | 23 |
23 namespace utils = extension_function_test_utils; | 24 namespace utils = extension_function_test_utils; |
24 | 25 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ProfileSyncServiceMock* service = static_cast<ProfileSyncServiceMock*>( | 113 ProfileSyncServiceMock* service = static_cast<ProfileSyncServiceMock*>( |
113 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 114 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
114 profile, &ProfileSyncServiceMock::BuildMockProfileSyncService)); | 115 profile, &ProfileSyncServiceMock::BuildMockProfileSyncService)); |
115 | 116 |
116 associator_ = new browser_sync::SessionModelAssociator( | 117 associator_ = new browser_sync::SessionModelAssociator( |
117 static_cast<ProfileSyncService*>(service), true); | 118 static_cast<ProfileSyncService*>(service), true); |
118 syncer::ModelTypeSet preferred_types; | 119 syncer::ModelTypeSet preferred_types; |
119 preferred_types.Put(syncer::SESSIONS); | 120 preferred_types.Put(syncer::SESSIONS); |
120 GoogleServiceAuthError no_error(GoogleServiceAuthError::NONE); | 121 GoogleServiceAuthError no_error(GoogleServiceAuthError::NONE); |
121 | 122 |
122 ON_CALL(*service, GetSessionModelAssociator()).WillByDefault( | 123 ON_CALL(*service, GetOpenTabsUIDelegate()).WillByDefault( |
123 testing::Return(associator_)); | 124 testing::Return(associator_)); |
124 ON_CALL(*service, GetPreferredDataTypes()).WillByDefault( | 125 ON_CALL(*service, GetPreferredDataTypes()).WillByDefault( |
125 testing::Return(preferred_types)); | 126 testing::Return(preferred_types)); |
126 EXPECT_CALL(*service, GetAuthError()).WillRepeatedly( | 127 EXPECT_CALL(*service, GetAuthError()).WillRepeatedly( |
127 testing::ReturnRef(no_error)); | 128 testing::ReturnRef(no_error)); |
128 ON_CALL(*service, GetActiveDataTypes()).WillByDefault( | 129 ON_CALL(*service, GetActiveDataTypes()).WillByDefault( |
129 testing::Return(preferred_types)); | 130 testing::Return(preferred_types)); |
130 EXPECT_CALL(*service, AddObserver(testing::_)).Times(testing::AnyNumber()); | 131 EXPECT_CALL(*service, AddObserver(testing::_)).Times(testing::AnyNumber()); |
131 EXPECT_CALL(*service, RemoveObserver(testing::_)).Times(testing::AnyNumber()); | 132 EXPECT_CALL(*service, RemoveObserver(testing::_)).Times(testing::AnyNumber()); |
132 | 133 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 277 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
277 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 278 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
278 return; | 279 return; |
279 #endif | 280 #endif |
280 | 281 |
281 ASSERT_TRUE(RunExtensionSubtest("sessions", | 282 ASSERT_TRUE(RunExtensionSubtest("sessions", |
282 "sessions.html")) << message_; | 283 "sessions.html")) << message_; |
283 } | 284 } |
284 | 285 |
285 } // namespace extensions | 286 } // namespace extensions |
OLD | NEW |