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 "chrome/browser/apps/app_browsertest_util.h" | 5 #include "chrome/browser/apps/app_browsertest_util.h" |
6 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 6 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
7 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 7 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
8 #include "chrome/browser/chromeos/drive/file_system_util.h" | 8 #include "chrome/browser/chromeos/drive/file_system_util.h" |
9 #include "chrome/browser/chromeos/drive/test_util.h" | 9 #include "chrome/browser/chromeos/drive/test_util.h" |
| 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
10 #include "chrome/browser/drive/fake_drive_service.h" | 11 #include "chrome/browser/drive/fake_drive_service.h" |
11 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 12 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
12 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
13 #include "google_apis/drive/test_util.h" | 14 #include "google_apis/drive/test_util.h" |
14 | 15 |
| 16 |
15 namespace extensions { | 17 namespace extensions { |
16 | 18 |
17 // This class contains chrome.filesystem API test specific to Chrome OS, namely, | 19 // This class contains chrome.filesystem API test specific to Chrome OS, namely, |
18 // the integrated Google Drive support. | 20 // the integrated Google Drive support. |
19 class FileSystemApiTestForDrive : public PlatformAppBrowserTest { | 21 class FileSystemApiTestForDrive : public PlatformAppBrowserTest { |
20 public: | 22 public: |
21 FileSystemApiTestForDrive() | 23 FileSystemApiTestForDrive() |
22 : fake_drive_service_(NULL), | 24 : fake_drive_service_(NULL), |
23 integration_service_(NULL) { | 25 integration_service_(NULL) { |
24 } | 26 } |
(...skipping 28 matching lines...) Expand all Loading... |
53 } | 55 } |
54 | 56 |
55 virtual void TearDown() OVERRIDE { | 57 virtual void TearDown() OVERRIDE { |
56 FileSystemChooseEntryFunction::StopSkippingPickerForTest(); | 58 FileSystemChooseEntryFunction::StopSkippingPickerForTest(); |
57 PlatformAppBrowserTest::TearDown(); | 59 PlatformAppBrowserTest::TearDown(); |
58 }; | 60 }; |
59 | 61 |
60 private: | 62 private: |
61 drive::DriveIntegrationService* CreateDriveIntegrationService( | 63 drive::DriveIntegrationService* CreateDriveIntegrationService( |
62 Profile* profile) { | 64 Profile* profile) { |
| 65 // Ignore signin profile. |
| 66 if (profile->GetPath() == chromeos::ProfileHelper::GetSigninProfileDir()) |
| 67 return NULL; |
| 68 |
| 69 // FileSystemApiTestForDrive doesn't expect that several user profiles could |
| 70 // exist simultaneously. |
| 71 CHECK(fake_drive_service_ == NULL); |
63 fake_drive_service_ = new drive::FakeDriveService; | 72 fake_drive_service_ = new drive::FakeDriveService; |
64 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 73 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
65 | 74 |
66 SetUpTestFileHierarchy(); | 75 SetUpTestFileHierarchy(); |
67 | 76 |
68 integration_service_ = new drive::DriveIntegrationService( | 77 integration_service_ = new drive::DriveIntegrationService( |
69 profile, NULL, fake_drive_service_, std::string(), | 78 profile, NULL, fake_drive_service_, std::string(), |
70 test_cache_root_.path(), NULL); | 79 test_cache_root_.path(), NULL); |
71 return integration_service_; | 80 return integration_service_; |
72 } | 81 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 drive::util::GetDriveMountPointPath(browser()->profile()).AppendASCII( | 185 drive::util::GetDriveMountPointPath(browser()->profile()).AppendASCII( |
177 "root/subdir"); | 186 "root/subdir"); |
178 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( | 187 FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( |
179 &test_directory); | 188 &test_directory); |
180 ASSERT_TRUE(RunPlatformAppTest( | 189 ASSERT_TRUE(RunPlatformAppTest( |
181 "api_test/file_system/open_directory_with_only_write")) | 190 "api_test/file_system/open_directory_with_only_write")) |
182 << message_; | 191 << message_; |
183 } | 192 } |
184 | 193 |
185 } // namespace extensions | 194 } // namespace extensions |
OLD | NEW |