| 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/extensions/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Child directory created in each of the mount points. | 37 // Child directory created in each of the mount points. |
| 38 const char kChildDirectory[] = "child-dir"; | 38 const char kChildDirectory[] = "child-dir"; |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 // Skips the user consent dialog for chrome.fileSystem.requestFileSystem() and | 42 // Skips the user consent dialog for chrome.fileSystem.requestFileSystem() and |
| 43 // simulates clicking of the specified dialog button. | 43 // simulates clicking of the specified dialog button. |
| 44 class ScopedSkipRequestFileSystemDialog { | 44 class ScopedSkipRequestFileSystemDialog { |
| 45 public: | 45 public: |
| 46 explicit ScopedSkipRequestFileSystemDialog(ui::DialogButton button) { | 46 explicit ScopedSkipRequestFileSystemDialog(ui::DialogButton button) { |
| 47 FileSystemRequestFileSystemFunction::SetAutoDialogButtonForTest(button); | 47 file_system_api::ConsentProviderDelegate::SetAutoDialogButtonForTest( |
| 48 button); |
| 48 } | 49 } |
| 49 ~ScopedSkipRequestFileSystemDialog() { | 50 ~ScopedSkipRequestFileSystemDialog() { |
| 50 FileSystemRequestFileSystemFunction::SetAutoDialogButtonForTest( | 51 file_system_api::ConsentProviderDelegate::SetAutoDialogButtonForTest( |
| 51 ui::DIALOG_BUTTON_NONE); | 52 ui::DIALOG_BUTTON_NONE); |
| 52 } | 53 } |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(ScopedSkipRequestFileSystemDialog); | 56 DISALLOW_COPY_AND_ASSIGN(ScopedSkipRequestFileSystemDialog); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 // This class contains chrome.filesystem API test specific to Chrome OS, namely, | 59 // This class contains chrome.filesystem API test specific to Chrome OS, namely, |
| 59 // the integrated Google Drive support. | 60 // the integrated Google Drive support. |
| 60 class FileSystemApiTestForDrive : public PlatformAppBrowserTest { | 61 class FileSystemApiTestForDrive : public PlatformAppBrowserTest { |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 407 |
| 407 IN_PROC_BROWSER_TEST_F(FileSystemApiTestForRequestFileSystem, | 408 IN_PROC_BROWSER_TEST_F(FileSystemApiTestForRequestFileSystem, |
| 408 NotWhitelistedComponent) { | 409 NotWhitelistedComponent) { |
| 409 ScopedSkipRequestFileSystemDialog dialog_skipper(ui::DIALOG_BUTTON_OK); | 410 ScopedSkipRequestFileSystemDialog dialog_skipper(ui::DIALOG_BUTTON_OK); |
| 410 ASSERT_TRUE(RunPlatformAppTestWithFlags( | 411 ASSERT_TRUE(RunPlatformAppTestWithFlags( |
| 411 "api_test/file_system/request_file_system_not_whitelisted_component", | 412 "api_test/file_system/request_file_system_not_whitelisted_component", |
| 412 kFlagLoadAsComponent)) | 413 kFlagLoadAsComponent)) |
| 413 << message_; | 414 << message_; |
| 414 } | 415 } |
| 415 | 416 |
| 417 IN_PROC_BROWSER_TEST_F(FileSystemApiTestForRequestFileSystem, GetVolumeList) { |
| 418 EnterKioskSession(); |
| 419 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_volume_list")) |
| 420 << message_; |
| 421 } |
| 422 |
| 423 IN_PROC_BROWSER_TEST_F(FileSystemApiTestForRequestFileSystem, |
| 424 GetVolumeList_NotKioskSession) { |
| 425 ASSERT_TRUE(RunPlatformAppTest( |
| 426 "api_test/file_system/get_volume_list_not_kiosk_session")) |
| 427 << message_; |
| 428 } |
| 429 |
| 416 } // namespace extensions | 430 } // namespace extensions |
| OLD | NEW |