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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/file_util.h"
6 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
7 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
8
9 class FileSystemApiTest : public PlatformAppBrowserTest {
10 public:
11 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
12 PlatformAppBrowserTest::SetUpCommandLine(command_line);
13 test_file_folder_ = test_data_dir_.AppendASCII("api_test")
14 .AppendASCII("file_system");
15 }
16
17 virtual void TearDown() OVERRIDE {
18 extensions::FileSystemPickerFunction::StopSkippingPickerForTest();
19 PlatformAppBrowserTest::TearDown();
20 };
21
22 protected:
23 FilePath test_file_folder_;
24 };
25
26 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) {
27 FilePath test_file = test_file_folder_.AppendASCII("open_existing.txt");
28 extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
29 &test_file);
30 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path"))
31 << message_;
32 }
33
34 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) {
35 FilePath test_file = test_file_folder_.AppendASCII("open_existing.txt");
36 extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
37 &test_file);
38 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing"))
39 << message_;
40 }
41
42 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenCancelTest) {
43 extensions::FileSystemPickerFunction::SkipPickerAndAlwaysCancelForTest();
44 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_cancel"))
45 << message_;
46 }
47
48 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenBackgroundTest) {
49 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_background"))
50 << message_;
51 }
52
53 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveNewFileTest) {
54 FilePath test_file = test_file_folder_.AppendASCII("save_new.txt");
55 // Make sure test file path does not exist.
56 ASSERT_TRUE(file_util::Delete(test_file, false));
57 extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
58 &test_file);
59 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_new"))
60 << message_;
61 }
62
63 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveExistingFileTest) {
64 FilePath test_file = test_file_folder_.AppendASCII("save_existing.txt");
65 // Replace test save file to make sure it's pristine.
66 ASSERT_TRUE(file_util::CopyFile(
67 test_file_folder_.AppendASCII("open_existing.txt"), test_file));
68 extensions::FileSystemPickerFunction::SkipPickerAndAlwaysSelectPathForTest(
69 &test_file);
70 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_existing"))
71 << message_;
72 }
73
74 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveCancelTest) {
75 extensions::FileSystemPickerFunction::SkipPickerAndAlwaysCancelForTest();
76 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_cancel"))
77 << message_;
78 }
79
80 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveBackgroundTest) {
81 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/save_background"))
82 << message_;
83 }
OLDNEW
« 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