| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // Browser test for basic Chrome OS file manager functionality: | 5 // Browser test for basic Chrome OS file manager functionality: |
| 6 // - The file list is updated when a file is added externally to the Downloads | 6 // - The file list is updated when a file is added externally to the Downloads |
| 7 // folder. | 7 // folder. |
| 8 // - Selecting a file and copy-pasting it with the keyboard copies the file. | 8 // - Selecting a file and copy-pasting it with the keyboard copies the file. |
| 9 // - Selecting a file and pressing delete deletes it. | 9 // - Selecting a file and pressing delete deletes it. |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 30 #include "chromeos/chromeos_switches.h" | 30 #include "chromeos/chromeos_switches.h" |
| 31 #include "content/public/browser/browser_context.h" | 31 #include "content/public/browser/browser_context.h" |
| 32 #include "webkit/browser/fileapi/external_mount_points.h" | 32 #include "webkit/browser/fileapi/external_mount_points.h" |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 // Test suffixes appended to the Javascript tests' names. | 36 // Test suffixes appended to the Javascript tests' names. |
| 37 const char kDownloadsVolume[] = "Downloads"; | 37 const char kDownloadsVolume[] = "Downloads"; |
| 38 const char kDriveVolume[] = "Drive"; | |
| 39 | 38 |
| 40 enum EntryType { | 39 enum EntryType { |
| 41 FILE, | 40 FILE, |
| 42 DIRECTORY, | 41 DIRECTORY, |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 enum SharedOption { | 44 enum SharedOption { |
| 46 NONE, | 45 NONE, |
| 47 SHARED, | 46 SHARED, |
| 48 }; | 47 }; |
| 49 | 48 |
| 49 enum GuestMode { |
| 50 NOT_IN_GUEST_MODE, |
| 51 IN_GUEST_MODE |
| 52 }; |
| 53 |
| 54 // This global operator is used from Google Test to format error messages. |
| 55 std::ostream& operator<<(std::ostream& os, const GuestMode& guest_mode) { |
| 56 return os << (guest_mode == IN_GUEST_MODE ? |
| 57 "IN_GUEST_MODE" : "NOT_IN_GUEST_MODE"); |
| 58 } |
| 59 |
| 50 struct TestEntryInfo { | 60 struct TestEntryInfo { |
| 51 EntryType type; | 61 EntryType type; |
| 52 const char* source_file_name; // Source file name to be used as a prototype. | 62 const char* source_file_name; // Source file name to be used as a prototype. |
| 53 const char* target_name; // Target file or directory name. | 63 const char* target_name; // Target file or directory name. |
| 54 const char* mime_type; | 64 const char* mime_type; |
| 55 SharedOption shared_option; | 65 SharedOption shared_option; |
| 56 const char* last_modified_time_as_string; | 66 const char* last_modified_time_as_string; |
| 57 }; | 67 }; |
| 58 | 68 |
| 59 TestEntryInfo kTestEntrySetCommon[] = { | 69 TestEntryInfo kTestEntrySetCommon[] = { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 | 87 |
| 78 // The base class of volumes for test. | 88 // The base class of volumes for test. |
| 79 // Sub-classes of this class are used by test cases and provide operations such | 89 // Sub-classes of this class are used by test cases and provide operations such |
| 80 // as creating files for each type of test volume. | 90 // as creating files for each type of test volume. |
| 81 class TestVolume { | 91 class TestVolume { |
| 82 public: | 92 public: |
| 83 virtual ~TestVolume() {} | 93 virtual ~TestVolume() {} |
| 84 | 94 |
| 85 // Creates an entry with given information. | 95 // Creates an entry with given information. |
| 86 virtual void CreateEntry(const TestEntryInfo& entry) = 0; | 96 virtual void CreateEntry(const TestEntryInfo& entry) = 0; |
| 87 | |
| 88 // Returns the name of volume such as "Downloads" or "Drive". | |
| 89 virtual std::string GetName() const = 0; | |
| 90 }; | 97 }; |
| 91 | 98 |
| 92 // The local volume class for test. | 99 // The local volume class for test. |
| 93 // This class provides the operations for a test volume that simulates local | 100 // This class provides the operations for a test volume that simulates local |
| 94 // drive. | 101 // drive. |
| 95 class LocalTestVolume : public TestVolume { | 102 class LocalTestVolume : public TestVolume { |
| 96 public: | 103 public: |
| 97 explicit LocalTestVolume(const std::string& mount_name) | 104 explicit LocalTestVolume(const std::string& mount_name) |
| 98 : mount_name_(mount_name) { | 105 : mount_name_(mount_name) { |
| 99 } | 106 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void CreateDirectory(const std::string& target_name, | 161 void CreateDirectory(const std::string& target_name, |
| 155 const std::string& modification_time) { | 162 const std::string& modification_time) { |
| 156 base::FilePath path = local_path_.AppendASCII(target_name); | 163 base::FilePath path = local_path_.AppendASCII(target_name); |
| 157 ASSERT_TRUE(file_util::CreateDirectory(path)) << | 164 ASSERT_TRUE(file_util::CreateDirectory(path)) << |
| 158 "Failed to create a directory: " << target_name; | 165 "Failed to create a directory: " << target_name; |
| 159 base::Time time; | 166 base::Time time; |
| 160 ASSERT_TRUE(base::Time::FromString(modification_time.c_str(), &time)); | 167 ASSERT_TRUE(base::Time::FromString(modification_time.c_str(), &time)); |
| 161 ASSERT_TRUE(file_util::SetLastModifiedTime(path, time)); | 168 ASSERT_TRUE(file_util::SetLastModifiedTime(path, time)); |
| 162 } | 169 } |
| 163 | 170 |
| 164 virtual std::string GetName() const OVERRIDE { | |
| 165 return mount_name_; | |
| 166 } | |
| 167 | |
| 168 private: | 171 private: |
| 169 std::string mount_name_; | 172 std::string mount_name_; |
| 170 base::FilePath local_path_; | 173 base::FilePath local_path_; |
| 171 base::ScopedTempDir tmp_dir_; | 174 base::ScopedTempDir tmp_dir_; |
| 172 }; | 175 }; |
| 173 | 176 |
| 174 // The drive volume class for test. | 177 // The drive volume class for test. |
| 175 // This class provides the operations for a test volume that simulates Google | 178 // This class provides the operations for a test volume that simulates Google |
| 176 // drive. | 179 // drive. |
| 177 class DriveTestVolume : public TestVolume { | 180 class DriveTestVolume : public TestVolume { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 resource_entry->resource_id(), | 230 resource_entry->resource_id(), |
| 228 time, | 231 time, |
| 229 google_apis::test_util::CreateCopyResultCallback(&error, | 232 google_apis::test_util::CreateCopyResultCallback(&error, |
| 230 &resource_entry)); | 233 &resource_entry)); |
| 231 base::MessageLoop::current()->RunUntilIdle(); | 234 base::MessageLoop::current()->RunUntilIdle(); |
| 232 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); | 235 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); |
| 233 ASSERT_TRUE(resource_entry); | 236 ASSERT_TRUE(resource_entry); |
| 234 CheckForUpdates(); | 237 CheckForUpdates(); |
| 235 } | 238 } |
| 236 | 239 |
| 237 virtual std::string GetName() const OVERRIDE { | |
| 238 return "Drive"; | |
| 239 } | |
| 240 | |
| 241 // Creates a test file with the given spec. | 240 // Creates a test file with the given spec. |
| 242 // Serves |test_file_name| file. Pass an empty string for an empty file. | 241 // Serves |test_file_name| file. Pass an empty string for an empty file. |
| 243 void CreateFile(const std::string& source_file_name, | 242 void CreateFile(const std::string& source_file_name, |
| 244 const std::string& target_file_name, | 243 const std::string& target_file_name, |
| 245 const std::string& mime_type, | 244 const std::string& mime_type, |
| 246 bool shared_with_me, | 245 bool shared_with_me, |
| 247 const std::string& modification_time) { | 246 const std::string& modification_time) { |
| 248 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 247 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; |
| 249 | 248 |
| 250 std::string content_data; | 249 std::string content_data; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 NULL); | 304 NULL); |
| 306 return integration_service_; | 305 return integration_service_; |
| 307 } | 306 } |
| 308 | 307 |
| 309 private: | 308 private: |
| 310 base::ScopedTempDir test_cache_root_; | 309 base::ScopedTempDir test_cache_root_; |
| 311 google_apis::FakeDriveService* fake_drive_service_; | 310 google_apis::FakeDriveService* fake_drive_service_; |
| 312 drive::DriveIntegrationService* integration_service_; | 311 drive::DriveIntegrationService* integration_service_; |
| 313 }; | 312 }; |
| 314 | 313 |
| 315 // The base test class. Used by FileManagerBrowserLocalTest, | 314 // Parameter of FileManagerBrowserTestBase. |
| 316 // FileManagerBrowserDriveTest, and FileManagerBrowserTransferTest. | 315 // The second value is the case name of javascript. |
| 317 // The boolean parameter, retrieved by GetParam(), is true if testing in the | 316 typedef std::tr1::tuple<GuestMode, const char*> TestParameter; |
| 318 // guest mode. See SetUpCommandLine() below for details. | 317 |
| 319 class FileManagerBrowserTestBase : public ExtensionApiTest, | 318 // The base test class. |
| 320 public ::testing::WithParamInterface<bool> { | 319 class FileManagerBrowserTestBase : |
| 320 public ExtensionApiTest, |
| 321 public ::testing::WithParamInterface<TestParameter> { |
| 321 protected: | 322 protected: |
| 323 FileManagerBrowserTestBase() : |
| 324 local_volume_(new LocalTestVolume(kDownloadsVolume)), |
| 325 drive_volume_(std::tr1::get<0>(GetParam()) != IN_GUEST_MODE ? |
| 326 new DriveTestVolume() : NULL), |
| 327 guest_mode_(std::tr1::get<0>(GetParam())) {} |
| 328 |
| 329 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 330 |
| 331 virtual void SetUpOnMainThread() OVERRIDE; |
| 332 |
| 322 // Adds an incognito and guest-mode flags for tests in the guest mode. | 333 // Adds an incognito and guest-mode flags for tests in the guest mode. |
| 323 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 334 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 324 | 335 |
| 325 // Loads our testing extension and sends it a string identifying the current | 336 // Loads our testing extension and sends it a string identifying the current |
| 326 // test. | 337 // test. |
| 327 void StartTest(const std::string& test_name); | 338 void StartTest(); |
| 328 | 339 |
| 329 // Creates test files and directories. | 340 // Creates test files and directories. |
| 330 void CreateTestEntries(TestVolume* volume, const TestEntryInfo* entries, | 341 void CreateTestEntries(TestVolume* volume, |
| 342 const TestEntryInfo* entries, |
| 331 size_t num_entries); | 343 size_t num_entries); |
| 332 | 344 |
| 333 // Runs the file display test on the passed |volume|, shared by subclasses. | 345 protected: |
| 334 void DoTestFileDisplay(TestVolume* volume); | 346 const scoped_ptr<LocalTestVolume> local_volume_; |
| 347 const scoped_ptr<DriveTestVolume> drive_volume_; |
| 348 |
| 349 private: |
| 350 GuestMode guest_mode_; |
| 335 }; | 351 }; |
| 336 | 352 |
| 353 void FileManagerBrowserTestBase::SetUpInProcessBrowserTestFixture() { |
| 354 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 355 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); |
| 356 if (drive_volume_) |
| 357 ASSERT_TRUE(drive_volume_->SetUp()); |
| 358 } |
| 359 |
| 360 void FileManagerBrowserTestBase::SetUpOnMainThread() { |
| 361 ExtensionApiTest::SetUpOnMainThread(); |
| 362 ASSERT_TRUE(local_volume_->Mount(browser()->profile())); |
| 363 CreateTestEntries(local_volume_.get(), |
| 364 kTestEntrySetCommon, |
| 365 arraysize(kTestEntrySetCommon)); |
| 366 if (drive_volume_) { |
| 367 CreateTestEntries(drive_volume_.get(), |
| 368 kTestEntrySetCommon, |
| 369 arraysize(kTestEntrySetCommon)); |
| 370 // For testing Drive, create more entries with Drive specific attributes. |
| 371 // TODO(haruki): Add a case for an entry cached by DriveCache. |
| 372 CreateTestEntries(drive_volume_.get(), |
| 373 kTestEntrySetDriveOnly, |
| 374 arraysize(kTestEntrySetDriveOnly)); |
| 375 drive_test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); |
| 376 } |
| 377 } |
| 378 |
| 337 void FileManagerBrowserTestBase::SetUpCommandLine(CommandLine* command_line) { | 379 void FileManagerBrowserTestBase::SetUpCommandLine(CommandLine* command_line) { |
| 338 bool in_guest_mode = GetParam(); | 380 if (guest_mode_ == IN_GUEST_MODE) { |
| 339 if (in_guest_mode) { | |
| 340 command_line->AppendSwitch(chromeos::switches::kGuestSession); | 381 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
| 341 command_line->AppendSwitchNative(chromeos::switches::kLoginUser, ""); | 382 command_line->AppendSwitchNative(chromeos::switches::kLoginUser, ""); |
| 342 command_line->AppendSwitch(switches::kIncognito); | 383 command_line->AppendSwitch(switches::kIncognito); |
| 343 } | 384 } |
| 344 ExtensionApiTest::SetUpCommandLine(command_line); | 385 ExtensionApiTest::SetUpCommandLine(command_line); |
| 345 } | 386 } |
| 346 | 387 |
| 347 void FileManagerBrowserTestBase::StartTest(const std::string& test_name) { | 388 void FileManagerBrowserTestBase::StartTest() { |
| 348 base::FilePath path = test_data_dir_.AppendASCII("file_manager_browsertest"); | 389 base::FilePath path = test_data_dir_.AppendASCII("file_manager_browsertest"); |
| 349 const extensions::Extension* extension = LoadExtensionAsComponent(path); | 390 const extensions::Extension* extension = LoadExtensionAsComponent(path); |
| 350 ASSERT_TRUE(extension); | 391 ASSERT_TRUE(extension); |
| 351 | 392 |
| 352 bool in_guest_mode = GetParam(); | 393 bool in_guest_mode = guest_mode_ == IN_GUEST_MODE; |
| 353 ExtensionTestMessageListener listener( | 394 ExtensionTestMessageListener listener( |
| 354 in_guest_mode ? "which test guest" : "which test non-guest", true); | 395 in_guest_mode ? "which test guest" : "which test non-guest", true); |
| 355 ASSERT_TRUE(listener.WaitUntilSatisfied()); | 396 ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| 356 listener.Reply(test_name); | 397 listener.Reply(std::tr1::get<1>(GetParam())); |
| 357 } | 398 } |
| 358 | 399 |
| 359 void FileManagerBrowserTestBase::CreateTestEntries( | 400 void FileManagerBrowserTestBase::CreateTestEntries( |
| 360 TestVolume* volume, const TestEntryInfo* entries, size_t num_entries) { | 401 TestVolume* volume, const TestEntryInfo* entries, size_t num_entries) { |
| 361 for (size_t i = 0; i < num_entries; ++i) { | 402 for (size_t i = 0; i < num_entries; ++i) { |
| 362 volume->CreateEntry(entries[i]); | 403 volume->CreateEntry(entries[i]); |
| 363 } | 404 } |
| 364 } | 405 } |
| 365 | 406 |
| 366 void FileManagerBrowserTestBase::DoTestFileDisplay(TestVolume* volume) { | 407 class FileManagerBrowserFileDisplayTest : public FileManagerBrowserTestBase {}; |
| 408 |
| 409 IN_PROC_BROWSER_TEST_P(FileManagerBrowserFileDisplayTest, Test) { |
| 367 ResultCatcher catcher; | 410 ResultCatcher catcher; |
| 368 ASSERT_NO_FATAL_FAILURE(StartTest("fileDisplay" + volume->GetName())); | 411 ASSERT_NO_FATAL_FAILURE(StartTest()); |
| 369 | 412 |
| 370 ExtensionTestMessageListener listener("initial check done", true); | 413 ExtensionTestMessageListener listener("initial check done", true); |
| 371 ASSERT_TRUE(listener.WaitUntilSatisfied()); | 414 ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| 372 const TestEntryInfo entry = { | 415 const TestEntryInfo entry = { |
| 373 FILE, | 416 FILE, |
| 374 "music.ogg", // Prototype file name. | 417 "music.ogg", // Prototype file name. |
| 375 "newly added file.ogg", // Target file name. | 418 "newly added file.ogg", // Target file name. |
| 376 "audio/ogg", | 419 "audio/ogg", |
| 377 NONE, | 420 NONE, |
| 378 "4 Sep 1998 00:00:00" | 421 "4 Sep 1998 00:00:00" |
| 379 }; | 422 }; |
| 380 volume->CreateEntry(entry); | 423 if (drive_volume_) |
| 424 drive_volume_->CreateEntry(entry); |
| 425 local_volume_->CreateEntry(entry); |
| 381 listener.Reply("file added"); | 426 listener.Reply("file added"); |
| 382 | 427 |
| 383 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 428 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 384 } | 429 } |
| 385 | 430 |
| 386 // A class to test local volumes. | 431 INSTANTIATE_TEST_CASE_P( |
| 387 class FileManagerBrowserLocalTest : public FileManagerBrowserTestBase { | 432 AllTests, |
| 388 public: | 433 FileManagerBrowserFileDisplayTest, |
| 389 FileManagerBrowserLocalTest() : volume_("Downloads") {} | 434 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "fileDisplayDownloads"), |
| 435 TestParameter(IN_GUEST_MODE, "fileDisplayDownloads"), |
| 436 TestParameter(NOT_IN_GUEST_MODE, "fileDisplayDrive"))); |
| 390 | 437 |
| 391 protected: | 438 // A test class that just executes JavaScript unit test. |
| 392 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 439 class FileManagerBrowserSimpleTest : public FileManagerBrowserTestBase {}; |
| 393 FileManagerBrowserTestBase::SetUpInProcessBrowserTestFixture(); | |
| 394 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); | |
| 395 } | |
| 396 | 440 |
| 397 virtual void SetUpOnMainThread() OVERRIDE { | 441 IN_PROC_BROWSER_TEST_P(FileManagerBrowserSimpleTest, Test) { |
| 398 FileManagerBrowserTestBase::SetUpOnMainThread(); | |
| 399 ASSERT_TRUE(volume_.Mount(browser()->profile())); | |
| 400 CreateTestEntries(&volume_, kTestEntrySetCommon, | |
| 401 arraysize(kTestEntrySetCommon)); | |
| 402 } | |
| 403 | |
| 404 LocalTestVolume volume_; | |
| 405 }; | |
| 406 | |
| 407 INSTANTIATE_TEST_CASE_P(InGuestMode, | |
| 408 FileManagerBrowserLocalTest, | |
| 409 ::testing::Values(true)); | |
| 410 | |
| 411 INSTANTIATE_TEST_CASE_P(InNonGuestMode, | |
| 412 FileManagerBrowserLocalTest, | |
| 413 ::testing::Values(false)); | |
| 414 | |
| 415 // A class to test Drive's volumes | |
| 416 class FileManagerBrowserDriveTest : public FileManagerBrowserTestBase { | |
| 417 protected: | |
| 418 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | |
| 419 FileManagerBrowserTestBase::SetUpInProcessBrowserTestFixture(); | |
| 420 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); | |
| 421 ASSERT_TRUE(volume_.SetUp()); | |
| 422 } | |
| 423 | |
| 424 virtual void SetUpOnMainThread() OVERRIDE { | |
| 425 FileManagerBrowserTestBase::SetUpOnMainThread(); | |
| 426 CreateTestEntries(&volume_, kTestEntrySetCommon, | |
| 427 arraysize(kTestEntrySetCommon)); | |
| 428 // For testing Drive, create more entries with Drive specific attributes. | |
| 429 // TODO(haruki): Add a case for an entry cached by DriveCache. | |
| 430 CreateTestEntries(&volume_, kTestEntrySetDriveOnly, | |
| 431 arraysize(kTestEntrySetDriveOnly)); | |
| 432 drive_test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); | |
| 433 } | |
| 434 | |
| 435 DriveTestVolume volume_; | |
| 436 }; | |
| 437 | |
| 438 // Don't test Drive in the guest mode as it's not supported. | |
| 439 INSTANTIATE_TEST_CASE_P(InNonGuestMode, | |
| 440 FileManagerBrowserDriveTest, | |
| 441 ::testing::Values(false)); | |
| 442 | |
| 443 // A class to test both local and Drive's volumes. | |
| 444 class FileManagerBrowserTransferTest : public FileManagerBrowserTestBase { | |
| 445 public: | |
| 446 FileManagerBrowserTransferTest() : local_volume_("Downloads") {} | |
| 447 | |
| 448 protected: | |
| 449 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | |
| 450 FileManagerBrowserTestBase::SetUpInProcessBrowserTestFixture(); | |
| 451 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); | |
| 452 ASSERT_TRUE(drive_volume_.SetUp()); | |
| 453 } | |
| 454 | |
| 455 virtual void SetUpOnMainThread() OVERRIDE { | |
| 456 FileManagerBrowserTestBase::SetUpOnMainThread(); | |
| 457 ASSERT_TRUE(local_volume_.Mount(browser()->profile())); | |
| 458 CreateTestEntries(&local_volume_, kTestEntrySetCommon, | |
| 459 arraysize(kTestEntrySetCommon)); | |
| 460 CreateTestEntries(&drive_volume_, kTestEntrySetCommon, | |
| 461 arraysize(kTestEntrySetCommon)); | |
| 462 CreateTestEntries(&drive_volume_, kTestEntrySetDriveOnly, | |
| 463 arraysize(kTestEntrySetDriveOnly)); | |
| 464 drive_test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); | |
| 465 } | |
| 466 | |
| 467 LocalTestVolume local_volume_; | |
| 468 DriveTestVolume drive_volume_; | |
| 469 }; | |
| 470 | |
| 471 // FileManagerBrowserTransferTest depends on Drive and Drive is not supported in | |
| 472 // the guest mode. | |
| 473 INSTANTIATE_TEST_CASE_P(InNonGuestMode, | |
| 474 FileManagerBrowserTransferTest, | |
| 475 ::testing::Values(false)); | |
| 476 | |
| 477 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestFileDisplay) { | |
| 478 DoTestFileDisplay(&volume_); | |
| 479 } | |
| 480 | |
| 481 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestGalleryOpen) { | |
| 482 ResultCatcher catcher; | 442 ResultCatcher catcher; |
| 483 ASSERT_NO_FATAL_FAILURE(StartTest("galleryOpenDownloads")); | 443 ASSERT_NO_FATAL_FAILURE(StartTest()); |
| 484 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 444 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 485 } | 445 } |
| 486 | 446 |
| 487 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestKeyboardDelete) { | 447 INSTANTIATE_TEST_CASE_P( |
| 488 ResultCatcher catcher; | 448 OpenSpecialTypes, |
| 489 ASSERT_NO_FATAL_FAILURE(StartTest("keyboardDeleteDownloads")); | 449 FileManagerBrowserSimpleTest, |
| 490 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 450 ::testing::Values(TestParameter(IN_GUEST_MODE, "videoOpenDownloads"), |
| 491 } | 451 TestParameter(NOT_IN_GUEST_MODE, "videoOpenDownloads"), |
| 452 TestParameter(NOT_IN_GUEST_MODE, "videoOpenDrive"), |
| 453 TestParameter(IN_GUEST_MODE, "audioOpenDownloads"), |
| 454 TestParameter(NOT_IN_GUEST_MODE, "audioOpenDownloads"), |
| 455 TestParameter(NOT_IN_GUEST_MODE, "audioOpenDrive"), |
| 456 TestParameter(IN_GUEST_MODE, "galleryOpenDownloads"), |
| 457 TestParameter(NOT_IN_GUEST_MODE, |
| 458 "galleryOpenDownloads"))); |
| 459 // Disabled temporarily since fails on Linux Chromium OS |
| 460 // ASAN Tests (2). TODO(mtomasz): crbug.com/243611. |
| 461 // TestParameter(NOT_IN_GUEST_MODE, "galleryOpenDrive"))); |
| 492 | 462 |
| 493 // Disabled temporarily since fails on Linux Chromium OS ASAN Tests (2). | 463 INSTANTIATE_TEST_CASE_P( |
| 494 // TODO(mtomasz): crbug.com/243611. | 464 KeyboardOpeartions, |
| 495 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, DISABLED_TestGalleryOpen) { | 465 FileManagerBrowserSimpleTest, |
| 496 ResultCatcher catcher; | 466 ::testing::Values(TestParameter(IN_GUEST_MODE, "keyboardDeleteDownloads"), |
| 497 ASSERT_NO_FATAL_FAILURE(StartTest("galleryOpenDrive")); | 467 TestParameter(NOT_IN_GUEST_MODE, |
| 498 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 468 "keyboardDeleteDownloads"), |
| 499 } | 469 TestParameter(NOT_IN_GUEST_MODE, "keyboardDeleteDrive"), |
| 470 TestParameter(IN_GUEST_MODE, "keyboardCopyDownloads"), |
| 471 TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDownloads"), |
| 472 TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDrive"))); |
| 500 | 473 |
| 501 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestAudioOpen) { | 474 INSTANTIATE_TEST_CASE_P( |
| 502 ResultCatcher catcher; | 475 DriveSpecific, |
| 503 ASSERT_NO_FATAL_FAILURE(StartTest("galleryOpenDownloads")); | 476 FileManagerBrowserSimpleTest, |
| 504 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();} | 477 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "openSidebarRecent"), |
| 478 TestParameter(NOT_IN_GUEST_MODE, "openSidebarOffline"), |
| 479 TestParameter(NOT_IN_GUEST_MODE, |
| 480 "openSidebarSharedWithMe"), |
| 481 TestParameter(NOT_IN_GUEST_MODE, "autocomplete"))); |
| 505 | 482 |
| 506 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestAudioOpen) { | 483 INSTANTIATE_TEST_CASE_P( |
| 507 ResultCatcher catcher; | 484 Transfer, |
| 508 ASSERT_NO_FATAL_FAILURE(StartTest("galleryOpenDrive")); | 485 FileManagerBrowserSimpleTest, |
| 509 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 486 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, |
| 510 } | 487 "transferFromDriveToDownloads"), |
| 511 | 488 TestParameter(NOT_IN_GUEST_MODE, |
| 512 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestVideoOpen) { | 489 "transferFromDownloadsToDrive"), |
| 513 ResultCatcher catcher; | 490 TestParameter(NOT_IN_GUEST_MODE, |
| 514 ASSERT_NO_FATAL_FAILURE(StartTest("galleryOpenDownloads")); | 491 "transferFromSharedToDownloads"), |
| 515 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 492 TestParameter(NOT_IN_GUEST_MODE, |
| 516 } | 493 "transferFromSharedToDrive"), |
| 517 | 494 TestParameter(NOT_IN_GUEST_MODE, |
| 518 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestVideoOpen) { | 495 "transferFromRecentToDownloads"), |
| 519 ResultCatcher catcher; | 496 TestParameter(NOT_IN_GUEST_MODE, |
| 520 ASSERT_NO_FATAL_FAILURE(StartTest("galleryOpenDrive")); | 497 "transferFromRecentToDrive"), |
| 521 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 498 TestParameter(NOT_IN_GUEST_MODE, |
| 522 } | 499 "transferFromOfflineToDownloads"), |
| 523 | 500 TestParameter(NOT_IN_GUEST_MODE, |
| 524 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestKeyboardCopy) { | 501 "transferFromOfflineToDrive"))); |
| 525 ResultCatcher catcher; | |
| 526 ASSERT_NO_FATAL_FAILURE(StartTest("keyboardCopyDrive")); | |
| 527 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 528 } | |
| 529 | |
| 530 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestKeyboardDelete) { | |
| 531 ResultCatcher catcher; | |
| 532 ASSERT_NO_FATAL_FAILURE(StartTest("keyboardDeleteDrive")); | |
| 533 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 534 } | |
| 535 | |
| 536 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestOpenRecent) { | |
| 537 ResultCatcher catcher; | |
| 538 ASSERT_NO_FATAL_FAILURE(StartTest("openSidebarRecent")); | |
| 539 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 540 } | |
| 541 | |
| 542 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestOpenOffline) { | |
| 543 ResultCatcher catcher; | |
| 544 ASSERT_NO_FATAL_FAILURE(StartTest("openSidebarOffline")); | |
| 545 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 546 } | |
| 547 | |
| 548 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestOpenSharedWithMe) { | |
| 549 ResultCatcher catcher; | |
| 550 ASSERT_NO_FATAL_FAILURE(StartTest("openSidebarSharedWithMe")); | |
| 551 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 552 } | |
| 553 | |
| 554 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestAutocomplete) { | |
| 555 ResultCatcher catcher; | |
| 556 ASSERT_NO_FATAL_FAILURE(StartTest("autocomplete")); | |
| 557 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 558 } | |
| 559 | |
| 560 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 561 TransferFromDriveToDownloads) { | |
| 562 ResultCatcher catcher; | |
| 563 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromDriveToDownloads")); | |
| 564 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 565 } | |
| 566 | |
| 567 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 568 TransferFromDownloadsToDrive) { | |
| 569 ResultCatcher catcher; | |
| 570 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromDownloadsToDrive")); | |
| 571 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 572 } | |
| 573 | |
| 574 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 575 TransferFromSharedToDownloads) { | |
| 576 ResultCatcher catcher; | |
| 577 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromSharedToDownloads")); | |
| 578 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 579 } | |
| 580 | |
| 581 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 582 TransferFromSharedToDrive) { | |
| 583 ResultCatcher catcher; | |
| 584 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromSharedToDrive")); | |
| 585 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 586 } | |
| 587 | |
| 588 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 589 TransferFromRecentToDownloads) { | |
| 590 ResultCatcher catcher; | |
| 591 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromRecentToDownloads")); | |
| 592 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 593 } | |
| 594 | |
| 595 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 596 TransferFromRecentToDrive) { | |
| 597 ResultCatcher catcher; | |
| 598 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromRecentToDrive")); | |
| 599 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 600 } | |
| 601 | |
| 602 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 603 TransferFromOfflineToDownloads) { | |
| 604 ResultCatcher catcher; | |
| 605 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromOfflineToDownloads")); | |
| 606 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 607 } | |
| 608 | |
| 609 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | |
| 610 TransferFromOfflineToDrive) { | |
| 611 ResultCatcher catcher; | |
| 612 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromOfflineToDrive")); | |
| 613 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 614 } | |
| 615 | 502 |
| 616 } // namespace | 503 } // namespace |
| OLD | NEW |