| 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 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 select_file_function->set_has_callback(true); | 333 select_file_function->set_has_callback(true); |
| 334 select_file_function->set_user_gesture(true); | 334 select_file_function->set_user_gesture(true); |
| 335 | 335 |
| 336 scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( | 336 scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( |
| 337 utils::RunFunctionAndReturnSingleResult( | 337 utils::RunFunctionAndReturnSingleResult( |
| 338 select_file_function.get(), | 338 select_file_function.get(), |
| 339 "[{\"suggestedName\": \"some_file_name.txt\"}]", | 339 "[{\"suggestedName\": \"some_file_name.txt\"}]", |
| 340 browser()))); | 340 browser()))); |
| 341 | 341 |
| 342 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); | 342 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); |
| 343 DictionaryValue* entry_info; | 343 base::DictionaryValue* entry_info; |
| 344 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); | 344 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); |
| 345 } | 345 } |
| 346 | 346 |
| 347 // Tests that user cannot be suggested a full file path when selecting a file, | 347 // Tests that user cannot be suggested a full file path when selecting a file, |
| 348 // only a file name (i.e. that extension function caller has no influence on | 348 // only a file name (i.e. that extension function caller has no influence on |
| 349 // which directory contents will be initially displayed in selection dialog). | 349 // which directory contents will be initially displayed in selection dialog). |
| 350 IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SuggestedFullPath) { | 350 IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SuggestedFullPath) { |
| 351 TestCase test_case(base::FilePath("some_file_name.txt"), | 351 TestCase test_case(base::FilePath("some_file_name.txt"), |
| 352 std::vector<std::string>(), | 352 std::vector<std::string>(), |
| 353 false, | 353 false, |
| 354 base::FilePath()); | 354 base::FilePath()); |
| 355 | 355 |
| 356 scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> | 356 scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> |
| 357 select_file_function( | 357 select_file_function( |
| 358 new FileBrowserHandlerInternalSelectFileFunction( | 358 new FileBrowserHandlerInternalSelectFileFunction( |
| 359 new MockFileSelectorFactory(test_case), | 359 new MockFileSelectorFactory(test_case), |
| 360 false)); | 360 false)); |
| 361 | 361 |
| 362 select_file_function->set_has_callback(true); | 362 select_file_function->set_has_callback(true); |
| 363 select_file_function->set_user_gesture(true); | 363 select_file_function->set_user_gesture(true); |
| 364 | 364 |
| 365 scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( | 365 scoped_ptr<base::DictionaryValue> result(utils::ToDictionary( |
| 366 utils::RunFunctionAndReturnSingleResult( | 366 utils::RunFunctionAndReturnSingleResult( |
| 367 select_file_function.get(), | 367 select_file_function.get(), |
| 368 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", | 368 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", |
| 369 browser()))); | 369 browser()))); |
| 370 | 370 |
| 371 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); | 371 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); |
| 372 DictionaryValue* entry_info; | 372 base::DictionaryValue* entry_info; |
| 373 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); | 373 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); |
| 374 } | 374 } |
| 375 | 375 |
| 376 } // namespace | 376 } // namespace |
| OLD | NEW |