| OLD | NEW |
| 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_manager/file_browser_handler_a
pi.h" | 7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a
pi.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/extensions/extension_apitest.h" | 14 #include "chrome/browser/extensions/extension_apitest.h" |
| 15 #include "chrome/browser/extensions/extension_function_test_utils.h" | 15 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
| 21 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 22 #include "extensions/test/result_catcher.h" |
| 22 #include "webkit/browser/fileapi/external_mount_points.h" | 23 #include "webkit/browser/fileapi/external_mount_points.h" |
| 23 #include "webkit/common/fileapi/file_system_types.h" | 24 #include "webkit/common/fileapi/file_system_types.h" |
| 24 | 25 |
| 25 namespace utils = extension_function_test_utils; | 26 namespace utils = extension_function_test_utils; |
| 26 | 27 |
| 27 using content::BrowserContext; | 28 using content::BrowserContext; |
| 28 using extensions::Extension; | 29 using extensions::Extension; |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 267 |
| 267 // Selected path should still not exist. | 268 // Selected path should still not exist. |
| 268 ASSERT_FALSE(base::PathExists(selected_path)); | 269 ASSERT_FALSE(base::PathExists(selected_path)); |
| 269 | 270 |
| 270 const Extension* extension = LoadExtension( | 271 const Extension* extension = LoadExtension( |
| 271 test_data_dir_.AppendASCII("file_browser/filehandler_create")); | 272 test_data_dir_.AppendASCII("file_browser/filehandler_create")); |
| 272 ASSERT_TRUE(extension) << message_; | 273 ASSERT_TRUE(extension) << message_; |
| 273 | 274 |
| 274 AddTmpMountPoint(extension->id()); | 275 AddTmpMountPoint(extension->id()); |
| 275 | 276 |
| 276 ResultCatcher catcher; | 277 extensions::ResultCatcher catcher; |
| 277 | 278 |
| 278 GURL url = extension->GetResourceURL("test.html"); | 279 GURL url = extension->GetResourceURL("test.html"); |
| 279 ui_test_utils::NavigateToURL(browser(), url); | 280 ui_test_utils::NavigateToURL(browser(), url); |
| 280 | 281 |
| 281 ASSERT_TRUE(catcher.GetNextResult()) << message_; | 282 ASSERT_TRUE(catcher.GetNextResult()) << message_; |
| 282 | 283 |
| 283 // Selected path should have been created by the test extension after the | 284 // Selected path should have been created by the test extension after the |
| 284 // extension function call. | 285 // extension function call. |
| 285 ASSERT_TRUE(base::PathExists(selected_path)); | 286 ASSERT_TRUE(base::PathExists(selected_path)); |
| 286 | 287 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 select_file_function.get(), | 368 select_file_function.get(), |
| 368 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", | 369 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", |
| 369 browser()))); | 370 browser()))); |
| 370 | 371 |
| 371 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); | 372 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); |
| 372 base::DictionaryValue* entry_info; | 373 base::DictionaryValue* entry_info; |
| 373 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); | 374 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); |
| 374 } | 375 } |
| 375 | 376 |
| 376 } // namespace | 377 } // namespace |
| OLD | NEW |