| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 CreateDirectory( | 379 CreateDirectory( |
| 380 parent_entry->resource_id(), target_name, entry.last_modified_time); | 380 parent_entry->resource_id(), target_name, entry.last_modified_time); |
| 381 break; | 381 break; |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 // Creates an empty directory with the given |name| and |modification_time|. | 385 // Creates an empty directory with the given |name| and |modification_time|. |
| 386 void CreateDirectory(const std::string& parent_id, | 386 void CreateDirectory(const std::string& parent_id, |
| 387 const std::string& target_name, | 387 const std::string& target_name, |
| 388 const base::Time& modification_time) { | 388 const base::Time& modification_time) { |
| 389 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 389 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
| 390 scoped_ptr<google_apis::FileResource> entry; | 390 scoped_ptr<google_apis::FileResource> entry; |
| 391 fake_drive_service_->AddNewDirectory( | 391 fake_drive_service_->AddNewDirectory( |
| 392 parent_id, | 392 parent_id, |
| 393 target_name, | 393 target_name, |
| 394 drive::DriveServiceInterface::AddNewDirectoryOptions(), | 394 drive::DriveServiceInterface::AddNewDirectoryOptions(), |
| 395 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 395 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| 396 base::MessageLoop::current()->RunUntilIdle(); | 396 base::MessageLoop::current()->RunUntilIdle(); |
| 397 ASSERT_EQ(google_apis::HTTP_CREATED, error); | 397 ASSERT_EQ(google_apis::HTTP_CREATED, error); |
| 398 ASSERT_TRUE(entry); | 398 ASSERT_TRUE(entry); |
| 399 | 399 |
| 400 fake_drive_service_->SetLastModifiedTime( | 400 fake_drive_service_->SetLastModifiedTime( |
| 401 entry->file_id(), | 401 entry->file_id(), |
| 402 modification_time, | 402 modification_time, |
| 403 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 403 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| 404 base::MessageLoop::current()->RunUntilIdle(); | 404 base::MessageLoop::current()->RunUntilIdle(); |
| 405 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); | 405 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); |
| 406 ASSERT_TRUE(entry); | 406 ASSERT_TRUE(entry); |
| 407 CheckForUpdates(); | 407 CheckForUpdates(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 // Creates a test file with the given spec. | 410 // Creates a test file with the given spec. |
| 411 // Serves |test_file_name| file. Pass an empty string for an empty file. | 411 // Serves |test_file_name| file. Pass an empty string for an empty file. |
| 412 void CreateFile(const std::string& source_file_name, | 412 void CreateFile(const std::string& source_file_name, |
| 413 const std::string& parent_id, | 413 const std::string& parent_id, |
| 414 const std::string& target_name, | 414 const std::string& target_name, |
| 415 const std::string& mime_type, | 415 const std::string& mime_type, |
| 416 bool shared_with_me, | 416 bool shared_with_me, |
| 417 const base::Time& modification_time) { | 417 const base::Time& modification_time) { |
| 418 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 418 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
| 419 | 419 |
| 420 std::string content_data; | 420 std::string content_data; |
| 421 if (!source_file_name.empty()) { | 421 if (!source_file_name.empty()) { |
| 422 base::FilePath source_file_path = | 422 base::FilePath source_file_path = |
| 423 google_apis::test_util::GetTestFilePath("chromeos/file_manager"). | 423 google_apis::test_util::GetTestFilePath("chromeos/file_manager"). |
| 424 AppendASCII(source_file_name); | 424 AppendASCII(source_file_name); |
| 425 ASSERT_TRUE(base::ReadFileToString(source_file_path, &content_data)); | 425 ASSERT_TRUE(base::ReadFileToString(source_file_path, &content_data)); |
| 426 } | 426 } |
| 427 | 427 |
| 428 scoped_ptr<google_apis::FileResource> entry; | 428 scoped_ptr<google_apis::FileResource> entry; |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 StartTest(); | 1517 StartTest(); |
| 1518 } | 1518 } |
| 1519 | 1519 |
| 1520 IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDrive) { | 1520 IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDrive) { |
| 1521 set_test_case_name("openSingleVideoOnDrive"); | 1521 set_test_case_name("openSingleVideoOnDrive"); |
| 1522 StartTest(); | 1522 StartTest(); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 } // namespace | 1525 } // namespace |
| 1526 } // namespace file_manager | 1526 } // namespace file_manager |
| OLD | NEW |