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

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: Rewrite getDisplayPath to focus on home directories, adds better Mac support Created 8 years, 3 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 test_root_folder_, false)); 59 test_root_folder_, false));
60 60
61 FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); 61 FilePath test_file = test_root_folder_.AppendASCII("gold.txt");
62 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( 62 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
63 &test_file); 63 &test_file);
64 ASSERT_TRUE(RunPlatformAppTest( 64 ASSERT_TRUE(RunPlatformAppTest(
65 "api_test/file_system/get_display_path_prettify")) << message_; 65 "api_test/file_system/get_display_path_prettify")) << message_;
66 } 66 }
67 #endif 67 #endif
68 68
69 #if defined(OS_MACOSX)
70 IN_PROC_BROWSER_TEST_F(FileSystemApiTest,
71 FileSystemApiGetDisplayPathPrettifyMac) {
72 // On Mac, "test.localized" will be localized into just "test".
73 FilePath test_path = TempFilePath("test.localized", false);
74 ASSERT_TRUE(file_util::CreateDirectory(test_path));
75
76 FilePath test_file = test_path.AppendASCII("gold.txt");
77 FilePath source = test_root_folder_.AppendASCII("gold.txt");
78 EXPECT_TRUE(file_util::CopyFile(source, test_file));
79
80 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
81 &test_file);
82 ASSERT_TRUE(RunPlatformAppTest(
83 "api_test/file_system/get_display_path_prettify_mac")) << message_;
84 }
85 #endif
86
69 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { 87 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) {
70 FilePath test_file = TempFilePath("open_existing.txt", true); 88 FilePath test_file = TempFilePath("open_existing.txt", true);
71 ASSERT_FALSE(test_file.empty()); 89 ASSERT_FALSE(test_file.empty());
72 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( 90 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
73 &test_file); 91 &test_file);
74 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing")) 92 ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/open_existing"))
75 << message_; 93 << message_;
76 } 94 }
77 95
78 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, 96 IN_PROC_BROWSER_TEST_F(FileSystemApiTest,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 213 }
196 214
197 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) { 215 IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) {
198 FilePath test_file = TempFilePath("writable.txt", true); 216 FilePath test_file = TempFilePath("writable.txt", true);
199 ASSERT_FALSE(test_file.empty()); 217 ASSERT_FALSE(test_file.empty());
200 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest( 218 FileSystemChooseFileFunction::SkipPickerAndAlwaysSelectPathForTest(
201 &test_file); 219 &test_file);
202 ASSERT_TRUE(RunPlatformAppTest( 220 ASSERT_TRUE(RunPlatformAppTest(
203 "api_test/file_system/is_writable_file_entry")) << message_; 221 "api_test/file_system/is_writable_file_entry")) << message_;
204 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698