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

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

Issue 10834383: Chrome OS "open with" picker allowing Web Intents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: tbarzic comments 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_browser_private_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 5 #include "base/bind.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/threading/worker_pool.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/chromeos/gdata/drive_file_system.h" 15 #include "chrome/browser/chromeos/gdata/drive_file_system.h"
16 #include "chrome/browser/chromeos/gdata/drive_system_service.h" 16 #include "chrome/browser/chromeos/gdata/drive_system_service.h"
17 #include "chrome/browser/chromeos/gdata/mock_drive_service.h" 17 #include "chrome/browser/chromeos/gdata/mock_drive_service.h"
18 #include "chrome/browser/extensions/event_router.h"
18 #include "chrome/browser/extensions/extension_apitest.h" 19 #include "chrome/browser/extensions/extension_apitest.h"
19 #include "chrome/browser/extensions/extension_test_message_listener.h" 20 #include "chrome/browser/extensions/extension_test_message_listener.h"
20 #include "chrome/browser/google_apis/gdata_util.h" 21 #include "chrome/browser/google_apis/gdata_util.h"
21 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 22 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
24 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/test/base/ui_test_utils.h"
27 #include "content/public/browser/browser_context.h" 29 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/storage_partition.h" 32 #include "content/public/browser/storage_partition.h"
31 #include "content/public/test/test_utils.h" 33 #include "content/public/test/test_utils.h"
32 #include "testing/gmock/include/gmock/gmock.h" 34 #include "testing/gmock/include/gmock/gmock.h"
33 #include "webkit/fileapi/file_system_context.h" 35 #include "webkit/fileapi/file_system_context.h"
34 #include "webkit/fileapi/file_system_mount_point_provider.h" 36 #include "webkit/fileapi/file_system_mount_point_provider.h"
35 37
36 using ::testing::_; 38 using ::testing::_;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 240 }
239 241
240 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestLazy) { 242 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestLazy) {
241 AddTmpMountPoint(); 243 AddTmpMountPoint();
242 ASSERT_TRUE(LoadExtensionAndWait("filesystem_handler_lazy_background")) 244 ASSERT_TRUE(LoadExtensionAndWait("filesystem_handler_lazy_background"))
243 << message_; 245 << message_;
244 ASSERT_TRUE(RunExtensionSubtest( 246 ASSERT_TRUE(RunExtensionSubtest(
245 "filebrowser_component", "read.html", kComponentFlags)) << message_; 247 "filebrowser_component", "read.html", kComponentFlags)) << message_;
246 } 248 }
247 249
250 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserWebIntentTest) {
251 AddTmpMountPoint();
252
253 ResultCatcher catcher;
254 ScopedTempDir tmp_dir;
255 ASSERT_TRUE(tmp_dir.CreateUniqueTempDir());
256
257 // Create a test file inside the ScopedTempDir.
258 FilePath test_file = tmp_dir.path().AppendASCII("text_file.xul");
259 CreateDownloadFile(test_file);
260
261 ASSERT_TRUE(LoadExtension(
262 test_data_dir_.AppendASCII("webintent_handler"))) << message_;
263
264 // Load the source component, with the fileUrl within the virtual mount
265 // point.
266 const extensions::Extension* extension = LoadExtensionAsComponent(
267 test_data_dir_.AppendASCII("filebrowser_component"));
268 ASSERT_TRUE(extension) << message_;
269 std::string path = "filesystem:chrome-extension://" + extension->id() +
270 "/external" + test_file.value();
271 GURL url = extension->GetResourceURL("intent.html#" + path);
272 ui_test_utils::NavigateToURL(browser(), url);
273
274 // The webintent_handler sends chrome.test.succeed() on successful receipt
275 // of the incoming Web Intent.
276 ASSERT_TRUE(catcher.GetNextResult()) << message_;
277 }
278
248 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) { 279 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestWrite) {
249 AddTmpMountPoint(); 280 AddTmpMountPoint();
250 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_; 281 ASSERT_TRUE(RunExtensionTest("filesystem_handler_write")) << message_;
251 ASSERT_TRUE(RunExtensionSubtest( 282 ASSERT_TRUE(RunExtensionSubtest(
252 "filebrowser_component", "write.html", kComponentFlags)) << message_; 283 "filebrowser_component", "write.html", kComponentFlags)) << message_;
253 } 284 }
254 285
255 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, 286 IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest,
256 FileBrowserTestWriteReadOnly) { 287 FileBrowserTestWriteReadOnly) {
257 AddTmpMountPoint(); 288 AddTmpMountPoint();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 _, _)) 380 _, _))
350 .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS)); 381 .WillOnce(MockDownloadFileCallback(gdata::HTTP_SUCCESS));
351 382
352 // On exit, all operations in progress should be cancelled. 383 // On exit, all operations in progress should be cancelled.
353 EXPECT_CALL(*mock_drive_service_, CancelAll()); 384 EXPECT_CALL(*mock_drive_service_, CancelAll());
354 385
355 // All is set... RUN THE TEST. 386 // All is set... RUN THE TEST.
356 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html", 387 EXPECT_TRUE(RunExtensionSubtest("filebrowser_component", "remote_search.html",
357 kComponentFlags)) << message_; 388 kComponentFlags)) << message_;
358 } 389 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_browser_private_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698