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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 10 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 public: | 290 public: |
291 DriveFileSystemExtensionApiTest() : fake_drive_service_(NULL) {} | 291 DriveFileSystemExtensionApiTest() : fake_drive_service_(NULL) {} |
292 virtual ~DriveFileSystemExtensionApiTest() {} | 292 virtual ~DriveFileSystemExtensionApiTest() {} |
293 | 293 |
294 // FileSystemExtensionApiTestBase OVERRIDE. | 294 // FileSystemExtensionApiTestBase OVERRIDE. |
295 virtual void InitTestFileSystem() OVERRIDE { | 295 virtual void InitTestFileSystem() OVERRIDE { |
296 // Set up cache root to be used by DriveIntegrationService. This has to be | 296 // Set up cache root to be used by DriveIntegrationService. This has to be |
297 // done before the browser is created because the service instance is | 297 // done before the browser is created because the service instance is |
298 // initialized by EventRouter. | 298 // initialized by EventRouter. |
299 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir()); | 299 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir()); |
300 | 300 |
tbarzic
2014/01/09 01:58:25
you could also (optionally) do something like:
th
James Cook
2014/01/09 17:32:19
Nice idea. Done.
| |
301 drive::DriveIntegrationServiceFactory::SetFactoryForTest( | 301 drive::DriveIntegrationServiceFactory::SetFactoryForTest( |
302 base::Bind( | 302 &DriveFileSystemExtensionApiTest::OnCreateDriveIntegrationService, |
303 &DriveFileSystemExtensionApiTest::CreateDriveIntegrationService, | 303 this); |
304 base::Unretained(this))); | |
305 } | 304 } |
306 | 305 |
307 // FileSystemExtensionApiTestBase OVERRIDE. | 306 // FileSystemExtensionApiTestBase OVERRIDE. |
308 virtual void AddTestMountPoint() OVERRIDE { | 307 virtual void AddTestMountPoint() OVERRIDE { |
309 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); | 308 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); |
310 } | 309 } |
311 | 310 |
312 protected: | 311 protected: |
312 static drive::DriveIntegrationService* OnCreateDriveIntegrationService( | |
313 Profile* profile, void* data) { | |
314 DriveFileSystemExtensionApiTest* self = | |
315 static_cast<DriveFileSystemExtensionApiTest*>(data); | |
316 return self->CreateDriveIntegrationService(profile); | |
317 } | |
318 | |
313 // DriveIntegrationService factory function for this test. | 319 // DriveIntegrationService factory function for this test. |
314 drive::DriveIntegrationService* CreateDriveIntegrationService( | 320 drive::DriveIntegrationService* CreateDriveIntegrationService( |
315 Profile* profile) { | 321 Profile* profile) { |
316 fake_drive_service_ = new drive::FakeDriveService; | 322 fake_drive_service_ = new drive::FakeDriveService; |
317 fake_drive_service_->LoadResourceListForWapi(kTestRootFeed); | 323 fake_drive_service_->LoadResourceListForWapi(kTestRootFeed); |
318 fake_drive_service_->LoadAccountMetadataForWapi( | 324 fake_drive_service_->LoadAccountMetadataForWapi( |
319 "gdata/account_metadata.json"); | 325 "gdata/account_metadata.json"); |
320 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 326 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
321 | 327 |
322 return new drive::DriveIntegrationService( | 328 return new drive::DriveIntegrationService( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 fake_drive_service_->set_default_max_results(1); | 433 fake_drive_service_->set_default_max_results(1); |
428 EXPECT_TRUE(RunFileSystemExtensionApiTest( | 434 EXPECT_TRUE(RunFileSystemExtensionApiTest( |
429 "file_browser/handler_test_runner", | 435 "file_browser/handler_test_runner", |
430 FILE_PATH_LITERAL("manifest.json"), | 436 FILE_PATH_LITERAL("manifest.json"), |
431 "file_browser/app_file_handler", | 437 "file_browser/app_file_handler", |
432 FLAGS_USE_FILE_HANDLER)) << message_; | 438 FLAGS_USE_FILE_HANDLER)) << message_; |
433 } | 439 } |
434 | 440 |
435 } // namespace | 441 } // namespace |
436 } // namespace file_manager | 442 } // namespace file_manager |
OLD | NEW |