| 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/pattern.h" | 9 #include "base/strings/pattern.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 factory->SetLocalDeviceInfoProvider( | 130 factory->SetLocalDeviceInfoProvider( |
| 131 scoped_ptr<sync_driver::LocalDeviceInfoProvider>( | 131 scoped_ptr<sync_driver::LocalDeviceInfoProvider>( |
| 132 new sync_driver::LocalDeviceInfoProviderMock( | 132 new sync_driver::LocalDeviceInfoProviderMock( |
| 133 kSessionTags[0], | 133 kSessionTags[0], |
| 134 "machine name", | 134 "machine name", |
| 135 "Chromium 10k", | 135 "Chromium 10k", |
| 136 "Chrome 10k", | 136 "Chrome 10k", |
| 137 sync_pb::SyncEnums_DeviceType_TYPE_LINUX, | 137 sync_pb::SyncEnums_DeviceType_TYPE_LINUX, |
| 138 "device_id"))); | 138 "device_id"))); |
| 139 | 139 |
| 140 Profile* profile = static_cast<Profile*>(context); | 140 return make_scoped_ptr(new ProfileSyncServiceMock( |
| 141 ProfileSyncServiceMock* sync_service = new ProfileSyncServiceMock( | 141 make_scoped_ptr(new browser_sync::ChromeSyncClient( |
| 142 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)), profile); | 142 static_cast<Profile*>(context), factory.Pass())), |
| 143 static_cast<browser_sync::ChromeSyncClient*>(sync_service->GetSyncClient()) | 143 static_cast<Profile*>(context))); |
| 144 ->SetSyncApiComponentFactoryForTesting(factory.Pass()); | |
| 145 return make_scoped_ptr(sync_service); | |
| 146 } | 144 } |
| 147 | 145 |
| 148 void ExtensionSessionsTest::CreateTestProfileSyncService() { | 146 void ExtensionSessionsTest::CreateTestProfileSyncService() { |
| 149 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 147 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 150 base::FilePath path; | 148 base::FilePath path; |
| 151 PathService::Get(chrome::DIR_USER_DATA, &path); | 149 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 152 path = path.AppendASCII("test_profile"); | 150 path = path.AppendASCII("test_profile"); |
| 153 if (!base::PathExists(path)) | 151 if (!base::PathExists(path)) |
| 154 CHECK(base::CreateDirectory(path)); | 152 CHECK(base::CreateDirectory(path)); |
| 155 Profile* profile = | 153 Profile* profile = |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 return; | 387 return; |
| 390 #endif | 388 #endif |
| 391 | 389 |
| 392 ASSERT_TRUE(RunExtensionSubtest("sessions", | 390 ASSERT_TRUE(RunExtensionSubtest("sessions", |
| 393 "sessions.html")) << message_; | 391 "sessions.html")) << message_; |
| 394 } | 392 } |
| 395 | 393 |
| 396 } // namespace | 394 } // namespace |
| 397 | 395 |
| 398 } // namespace extensions | 396 } // namespace extensions |
| OLD | NEW |