| 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 return make_scoped_ptr(new ProfileSyncServiceMock( | 140 Profile* profile = static_cast<Profile*>(context); |
| 141 make_scoped_ptr(new browser_sync::ChromeSyncClient( | 141 ProfileSyncServiceMock* sync_service = new ProfileSyncServiceMock( |
| 142 static_cast<Profile*>(context), factory.Pass())), | 142 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)), profile); |
| 143 static_cast<Profile*>(context))); | 143 static_cast<browser_sync::ChromeSyncClient*>(sync_service->GetSyncClient()) |
| 144 ->SetSyncApiComponentFactoryForTesting(factory.Pass()); |
| 145 return make_scoped_ptr(sync_service); |
| 144 } | 146 } |
| 145 | 147 |
| 146 void ExtensionSessionsTest::CreateTestProfileSyncService() { | 148 void ExtensionSessionsTest::CreateTestProfileSyncService() { |
| 147 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 149 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 148 base::FilePath path; | 150 base::FilePath path; |
| 149 PathService::Get(chrome::DIR_USER_DATA, &path); | 151 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 150 path = path.AppendASCII("test_profile"); | 152 path = path.AppendASCII("test_profile"); |
| 151 if (!base::PathExists(path)) | 153 if (!base::PathExists(path)) |
| 152 CHECK(base::CreateDirectory(path)); | 154 CHECK(base::CreateDirectory(path)); |
| 153 Profile* profile = | 155 Profile* profile = |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 return; | 389 return; |
| 388 #endif | 390 #endif |
| 389 | 391 |
| 390 ASSERT_TRUE(RunExtensionSubtest("sessions", | 392 ASSERT_TRUE(RunExtensionSubtest("sessions", |
| 391 "sessions.html")) << message_; | 393 "sessions.html")) << message_; |
| 392 } | 394 } |
| 393 | 395 |
| 394 } // namespace | 396 } // namespace |
| 395 | 397 |
| 396 } // namespace extensions | 398 } // namespace extensions |
| OLD | NEW |