Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5113)

Unified Diff: chrome/browser/extensions/api/file_system/file_system_apitest.cc

Issue 10663014: Add tests for chrome.fileSystem app API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added licenses to js files Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
+}
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698