OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/path_service.h" | 5 #include "base/path_service.h" |
6 #include "chrome/browser/apps/app_browsertest_util.h" | 6 #include "chrome/browser/apps/app_browsertest_util.h" |
7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
8 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 8 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/drive/fake_drive_service.h" | 10 #include "chrome/browser/drive/fake_drive_service.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // the integrated Google Drive support. | 21 // the integrated Google Drive support. |
22 class FileSystemApiTestForDrive : public PlatformAppBrowserTest { | 22 class FileSystemApiTestForDrive : public PlatformAppBrowserTest { |
23 public: | 23 public: |
24 FileSystemApiTestForDrive() | 24 FileSystemApiTestForDrive() |
25 : fake_drive_service_(NULL), | 25 : fake_drive_service_(NULL), |
26 integration_service_(NULL) { | 26 integration_service_(NULL) { |
27 } | 27 } |
28 | 28 |
29 // Sets up fake Drive service for tests (this has to be injected before the | 29 // Sets up fake Drive service for tests (this has to be injected before the |
30 // real DriveIntegrationService instance is created.) | 30 // real DriveIntegrationService instance is created.) |
31 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 31 virtual void SetUpInProcessBrowserTestFixture() override { |
32 PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture(); | 32 PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture(); |
33 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); | 33 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); |
34 | 34 |
35 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(test_cache_root_.CreateUniqueTempDir()); |
36 | 36 |
37 create_drive_integration_service_ = | 37 create_drive_integration_service_ = |
38 base::Bind(&FileSystemApiTestForDrive::CreateDriveIntegrationService, | 38 base::Bind(&FileSystemApiTestForDrive::CreateDriveIntegrationService, |
39 base::Unretained(this)); | 39 base::Unretained(this)); |
40 service_factory_for_test_.reset( | 40 service_factory_for_test_.reset( |
41 new drive::DriveIntegrationServiceFactory::ScopedFactoryForTest( | 41 new drive::DriveIntegrationServiceFactory::ScopedFactoryForTest( |
42 &create_drive_integration_service_)); | 42 &create_drive_integration_service_)); |
43 } | 43 } |
44 | 44 |
45 // Ensure the fake service's data is fetch in the local file system. This is | 45 // Ensure the fake service's data is fetch in the local file system. This is |
46 // necessary because the fetch starts lazily upon the first read operation. | 46 // necessary because the fetch starts lazily upon the first read operation. |
47 virtual void SetUpOnMainThread() OVERRIDE { | 47 virtual void SetUpOnMainThread() override { |
48 PlatformAppBrowserTest::SetUpOnMainThread(); | 48 PlatformAppBrowserTest::SetUpOnMainThread(); |
49 | 49 |
50 scoped_ptr<drive::ResourceEntry> entry; | 50 scoped_ptr<drive::ResourceEntry> entry; |
51 drive::FileError error = drive::FILE_ERROR_FAILED; | 51 drive::FileError error = drive::FILE_ERROR_FAILED; |
52 integration_service_->file_system()->GetResourceEntry( | 52 integration_service_->file_system()->GetResourceEntry( |
53 base::FilePath::FromUTF8Unsafe("drive/root"), // whatever | 53 base::FilePath::FromUTF8Unsafe("drive/root"), // whatever |
54 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 54 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
55 content::RunAllBlockingPoolTasksUntilIdle(); | 55 content::RunAllBlockingPoolTasksUntilIdle(); |
56 ASSERT_EQ(drive::FILE_ERROR_OK, error); | 56 ASSERT_EQ(drive::FILE_ERROR_OK, error); |
57 } | 57 } |
58 | 58 |
59 virtual void TearDown() OVERRIDE { | 59 virtual void TearDown() override { |
60 FileSystemChooseEntryFunction::StopSkippingPickerForTest(); | 60 FileSystemChooseEntryFunction::StopSkippingPickerForTest(); |
61 PlatformAppBrowserTest::TearDown(); | 61 PlatformAppBrowserTest::TearDown(); |
62 }; | 62 }; |
63 | 63 |
64 private: | 64 private: |
65 drive::DriveIntegrationService* CreateDriveIntegrationService( | 65 drive::DriveIntegrationService* CreateDriveIntegrationService( |
66 Profile* profile) { | 66 Profile* profile) { |
67 fake_drive_service_ = new drive::FakeDriveService; | 67 fake_drive_service_ = new drive::FakeDriveService; |
68 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 68 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
69 | 69 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 FileSystemApiSaveExistingFileWithWriteTest) { | 247 FileSystemApiSaveExistingFileWithWriteTest) { |
248 base::FilePath test_file = drive::util::GetDriveMountPointPath( | 248 base::FilePath test_file = drive::util::GetDriveMountPointPath( |
249 browser()->profile()).AppendASCII("root/save_existing.txt"); | 249 browser()->profile()).AppendASCII("root/save_existing.txt"); |
250 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 250 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
251 &test_file); | 251 &test_file); |
252 ASSERT_TRUE(RunPlatformAppTest( | 252 ASSERT_TRUE(RunPlatformAppTest( |
253 "api_test/file_system/save_existing_with_write")) << message_; | 253 "api_test/file_system/save_existing_with_write")) << message_; |
254 } | 254 } |
255 | 255 |
256 } // namespace extensions | 256 } // namespace extensions |
OLD | NEW |