| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/file_manager/file_tasks.h" | 5 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 FileHandlerInfo file_handler_info_8; | 398 FileHandlerInfo file_handler_info_8; |
| 399 file_handler_info_8.extensions.insert("*"); | 399 file_handler_info_8.extensions.insert("*"); |
| 400 file_handler_info_8.types.insert("image/*"); | 400 file_handler_info_8.types.insert("image/*"); |
| 401 EXPECT_TRUE(IsGenericFileHandler(file_handler_info_8)); | 401 EXPECT_TRUE(IsGenericFileHandler(file_handler_info_8)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 // Test using the test extension system, which needs lots of setup. | 404 // Test using the test extension system, which needs lots of setup. |
| 405 class FileManagerFileTasksComplexTest : public testing::Test { | 405 class FileManagerFileTasksComplexTest : public testing::Test { |
| 406 protected: | 406 protected: |
| 407 FileManagerFileTasksComplexTest() | 407 FileManagerFileTasksComplexTest() |
| 408 : command_line_(CommandLine::NO_PROGRAM), | 408 : command_line_(base::CommandLine::NO_PROGRAM), extension_service_(NULL) { |
| 409 extension_service_(NULL) { | |
| 410 extensions::TestExtensionSystem* test_extension_system = | 409 extensions::TestExtensionSystem* test_extension_system = |
| 411 static_cast<extensions::TestExtensionSystem*>( | 410 static_cast<extensions::TestExtensionSystem*>( |
| 412 extensions::ExtensionSystem::Get(&test_profile_)); | 411 extensions::ExtensionSystem::Get(&test_profile_)); |
| 413 extension_service_ = test_extension_system->CreateExtensionService( | 412 extension_service_ = test_extension_system->CreateExtensionService( |
| 414 &command_line_, | 413 &command_line_, |
| 415 base::FilePath() /* install_directory */, | 414 base::FilePath() /* install_directory */, |
| 416 false /* autoupdate_enabled*/); | 415 false /* autoupdate_enabled*/); |
| 417 } | 416 } |
| 418 | 417 |
| 419 content::TestBrowserThreadBundle thread_bundle_; | 418 content::TestBrowserThreadBundle thread_bundle_; |
| 420 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 419 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 421 chromeos::ScopedTestCrosSettings test_cros_settings_; | 420 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 422 chromeos::ScopedTestUserManager test_user_manager_; | 421 chromeos::ScopedTestUserManager test_user_manager_; |
| 423 TestingProfile test_profile_; | 422 TestingProfile test_profile_; |
| 424 CommandLine command_line_; | 423 base::CommandLine command_line_; |
| 425 ExtensionService* extension_service_; // Owned by test_profile_; | 424 ExtensionService* extension_service_; // Owned by test_profile_; |
| 426 }; | 425 }; |
| 427 | 426 |
| 428 // The basic logic is similar to a test case for FindDriveAppTasks above. | 427 // The basic logic is similar to a test case for FindDriveAppTasks above. |
| 429 TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTasks) { | 428 TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTasks) { |
| 430 // Random IDs generated by | 429 // Random IDs generated by |
| 431 // % ruby -le 'print (0...32).to_a.map{(?a + rand(16)).chr}.join' | 430 // % ruby -le 'print (0...32).to_a.map{(?a + rand(16)).chr}.join' |
| 432 const char kFooId[] = "hhgbjpmdppecanaaogonaigmmifgpaph"; | 431 const char kFooId[] = "hhgbjpmdppecanaaogonaigmmifgpaph"; |
| 433 const char kBarId[] = "odlhccgofgkadkkhcmhgnhgahonahoca"; | 432 const char kBarId[] = "odlhccgofgkadkkhcmhgnhgahonahoca"; |
| 434 const char kEphemeralId[] = "opoomfdlbjcbjinalcjdjfoiikdeaoel"; | 433 const char kEphemeralId[] = "opoomfdlbjcbjinalcjdjfoiikdeaoel"; |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 // treated as non-generic handler. | 982 // treated as non-generic handler. |
| 984 EXPECT_EQ("Baz", jpg_result[1].task_title()); | 983 EXPECT_EQ("Baz", jpg_result[1].task_title()); |
| 985 EXPECT_FALSE(jpg_result[1].is_generic_file_handler()); | 984 EXPECT_FALSE(jpg_result[1].is_generic_file_handler()); |
| 986 // Qux app provides a handler for all types. | 985 // Qux app provides a handler for all types. |
| 987 EXPECT_EQ("Qux", jpg_result[2].task_title()); | 986 EXPECT_EQ("Qux", jpg_result[2].task_title()); |
| 988 EXPECT_TRUE(jpg_result[2].is_generic_file_handler()); | 987 EXPECT_TRUE(jpg_result[2].is_generic_file_handler()); |
| 989 } | 988 } |
| 990 | 989 |
| 991 } // namespace file_tasks | 990 } // namespace file_tasks |
| 992 } // namespace file_manager. | 991 } // namespace file_manager. |
| OLD | NEW |