| Index: chrome/browser/extensions/api/file_system/file_system_apitest.cc
|
| diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest.cc b/chrome/browser/extensions/api/file_system/file_system_apitest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..68cf254f5940e05c1598ea218c4932440135ce02
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/file_system/file_system_apitest.cc
|
| @@ -0,0 +1,83 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/file_util.h"
|
| +#include "chrome/browser/extensions/api/file_system/file_system_api.h"
|
| +#include "chrome/browser/extensions/platform_app_browsertest_util.h"
|
| +
|
| +class FileSystemApiTest : public PlatformAppBrowserTest {
|
| + public:
|
| + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
|
| + PlatformAppBrowserTest::SetUpCommandLine(command_line);
|
| + test_file_folder_ = test_data_dir_.AppendASCII("api_test")
|
| + .AppendASCII("file_system");
|
| + }
|
| +
|
| + virtual void TearDown() OVERRIDE {
|
| + extensions::FileSystemPickerFunction::StopSkippingPickerForTest();
|
| + PlatformAppBrowserTest::TearDown();
|
| + };
|
| +
|
| + protected:
|
| + FilePath test_file_folder_;
|
| +};
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) {
|
| + FilePath test_file = test_file_folder_.AppendASCII("open_existing.txt");
|
| + extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
|
| + &test_file);
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) {
|
| + FilePath test_file = test_file_folder_.AppendASCII("open_existing.txt");
|
| + extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
|
| + &test_file);
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenCancelTest) {
|
| + extensions::FileSystemPickerFunction::SkipPickerAndAlwaysCancelForTest();
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_cancel"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenBackgroundTest) {
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_background"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveNewFileTest) {
|
| + FilePath test_file = test_file_folder_.AppendASCII("save_new.txt");
|
| + // Make sure test file path does not exist.
|
| + ASSERT_TRUE(file_util::Delete(test_file, false));
|
| + extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
|
| + &test_file);
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_new"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveExistingFileTest) {
|
| + FilePath test_file = test_file_folder_.AppendASCII("save_existing.txt");
|
| + // Replace test save file to make sure it's pristine.
|
| + ASSERT_TRUE(file_util::CopyFile(
|
| + test_file_folder_.AppendASCII("open_existing.txt"), test_file));
|
| + extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
|
| + &test_file);
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_existing"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveCancelTest) {
|
| + extensions::FileSystemPickerFunction::SkipPickerAndAlwaysCancelForTest();
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_cancel"))
|
| + << message_;
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveBackgroundTest) {
|
| + ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_background"))
|
| + << message_;
|
| +}
|
|
|