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

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_apitest.cc

Issue 10823157: Prettify Mac names, rewrite getDisplayPath API call to focus on $HOME (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Actually works on Mac now Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "chrome/browser/extensions/api/file_system/file_system_api.h" 7 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
8 #include "chrome/browser/extensions/platform_app_browsertest_util.h" 8 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
9 9
10 using extensions::FileSystemChooseFileFunction; 10 using extensions::FileSystemChooseFileFunction;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #if defined(OS_WIN) || defined(OS_POSIX) 51 #if defined(OS_WIN) || defined(OS_POSIX)
52 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { 52 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) {
53 #if defined(OS_WIN) 53 #if defined(OS_WIN)
54 int override = base::DIR_PROFILE; 54 int override = base::DIR_PROFILE;
55 #elif defined(OS_POSIX) 55 #elif defined(OS_POSIX)
56 int override = base::DIR_HOME; 56 int override = base::DIR_HOME;
57 #endif 57 #endif
58 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(override, 58 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(override,
59 test_root_folder_, false)); 59 test_root_folder_, false));
60 60
61 // TODO: this should be the ..._prettify_home test.
61 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); 62 FilePath test_file = test_root_folder_.AppendASCII("gold.txt");
62 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( 63 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
63 &test_file); 64 &test_file);
64 ASSERT_TRUE(RunPlatformAppTest( 65 ASSERT_TRUE(RunPlatformAppTest(
65 "api_test/file_system/get_display_path_prettify")) << message_; 66 "api_test/file_system/get_display_path_prettify")) << message_;
66 } 67 }
67 #endif 68 #endif
68 69
70 #if defined(OS_MACOSX)
71 IN_PROC_BROWSER_TEST_F(FileSystemApiTest,
72 FileSystemApiGetDisplayPathPrettifyMac) {
73 ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(base::DIR_DESKTOP,
74 test_root_folder_, false));
75
76 // TODO: The displayName of this folder is going to be "file_system", because it's not a real user-relevant folder to OS X.
77
78 FilePath test_file = test_root_folder_.AppendASCII("gold.txt");
79 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
80 &test_file);
81 ASSERT_TRUE(RunPlatformAppTest(
82 "api_test/file_system/get_display_path_prettify_mac")) << message_;
83
84 // TODO: I don't think the test code likes creating filesystems outside the te st folders. :(
85 #if 0
86 FilePath test_file;
87 ASSERT_TRUE(PathService::Get(base::DIR_DOCUMENTS, &test_file));
88 test_file = test_file.AppendASCII("gold.txt");
89
90 // TODO: this should be the generic test, we just confirm that it's a relative path.
91 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
92 &test_file);
93 ASSERT_TRUE(RunPlatformAppTest(
94 "api_test/file_system/get_display_path_prettify_mac")) << "could not run S TUFF";
95 #endif
96 }
97 #endif
98
69 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { 99 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) {
70 FilePath test_file = TempFilePath("open_existing.txt", true); 100 FilePath test_file = TempFilePath("open_existing.txt", true);
71 ASSERT_FALSE(test_file.empty()); 101 ASSERT_FALSE(test_file.empty());
72 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( 102 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
73 &test_file); 103 &test_file);
74 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing")) 104 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing"))
75 << message_; 105 << message_;
76 } 106 }
77 107
78 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, 108 IN_PROC_BROWSER_TEST_F(FileSystemApiTest,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 225 }
196 226
197 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) { 227 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) {
198 FilePath test_file = TempFilePath("writable.txt", true); 228 FilePath test_file = TempFilePath("writable.txt", true);
199 ASSERT_FALSE(test_file.empty()); 229 ASSERT_FALSE(test_file.empty());
200 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( 230 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
201 &test_file); 231 &test_file);
202 ASSERT_TRUE(RunPlatformAppTest( 232 ASSERT_TRUE(RunPlatformAppTest(
203 "api_test/file_system/is_writable_file_entry")) << message_; 233 "api_test/file_system/is_writable_file_entry")) << message_;
204 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698