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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove useless headers. 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 | Annotate | Revision Log
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 // File contains browser tests for the fileBrowserHandler api. 5 // File contains browser tests for the fileBrowserHandler api.
6 6
7 #include "chrome/browser/chromeos/extensions/file_browser_handler_api.h" 7 #include "chrome/browser/chromeos/extensions/file_browser_handler_api.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/scoped_temp_dir.h" 13 #include "base/scoped_temp_dir.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/extensions/extension_apitest.h" 15 #include "chrome/browser/extensions/extension_apitest.h"
16 #include "chrome/browser/extensions/extension_function_test_utils.h" 16 #include "chrome/browser/extensions/extension_function_test_utils.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
20 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/browser_context.h"
22 #include "content/public/browser/storage_partition.h"
21 #include "webkit/fileapi/file_system_context.h" 23 #include "webkit/fileapi/file_system_context.h"
22 #include "webkit/fileapi/file_system_mount_point_provider.h" 24 #include "webkit/fileapi/file_system_mount_point_provider.h"
23 25
24 namespace utils = extension_function_test_utils; 26 namespace utils = extension_function_test_utils;
25 27
26 using content::BrowserContext; 28 using content::BrowserContext;
27 using extensions::Extension; 29 using extensions::Extension;
28 30
29 namespace { 31 namespace {
30 32
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ASSERT_TRUE(scoped_tmp_dir_.CreateUniqueTempDirUnderPath(tmp_dir_path)); 166 ASSERT_TRUE(scoped_tmp_dir_.CreateUniqueTempDirUnderPath(tmp_dir_path));
165 tmp_mount_point_ = scoped_tmp_dir_.path().Append("tmp"); 167 tmp_mount_point_ = scoped_tmp_dir_.path().Append("tmp");
166 file_util::CreateDirectory(tmp_mount_point_); 168 file_util::CreateDirectory(tmp_mount_point_);
167 169
168 ExtensionApiTest::SetUp(); 170 ExtensionApiTest::SetUp();
169 } 171 }
170 172
171 // Creates new, test mount point. 173 // Creates new, test mount point.
172 void AddTmpMountPoint() { 174 void AddTmpMountPoint() {
173 fileapi::ExternalFileSystemMountPointProvider* provider = 175 fileapi::ExternalFileSystemMountPointProvider* provider =
174 BrowserContext::GetFileSystemContext(browser()->profile())-> 176 BrowserContext::GetDefaultStoragePartition(browser()->profile())->
175 external_provider(); 177 GetFileSystemContext()->external_provider();
176 provider->AddLocalMountPoint(tmp_mount_point_); 178 provider->AddLocalMountPoint(tmp_mount_point_);
177 } 179 }
178 180
179 FilePath GetFullPathOnTmpMountPoint(const FilePath& relative_path) { 181 FilePath GetFullPathOnTmpMountPoint(const FilePath& relative_path) {
180 return tmp_mount_point_.Append(relative_path); 182 return tmp_mount_point_.Append(relative_path);
181 } 183 }
182 184
183 // Creates a new FileHandlerSelectFileFunction to be used in the test. 185 // Creates a new FileHandlerSelectFileFunction to be used in the test.
184 // This function will be called from ExtensionFunctinoDispatcher whenever 186 // This function will be called from ExtensionFunctinoDispatcher whenever
185 // an extension function for fileBrowserHandlerInternal.selectFile will be 187 // an extension function for fileBrowserHandlerInternal.selectFile will be
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 select_file_function.get(), 352 select_file_function.get(),
351 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", 353 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]",
352 browser()))); 354 browser())));
353 355
354 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); 356 EXPECT_FALSE(utils::GetBoolean(result.get(), "success"));
355 DictionaryValue* entry_info; 357 DictionaryValue* entry_info;
356 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); 358 EXPECT_FALSE(result->GetDictionary("entry", &entry_info));
357 } 359 }
358 360
359 } // namespace 361 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698