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 |
11 #include <deque> | 11 #include <deque> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "apps/app_window.h" | 14 #include "apps/app_window.h" |
15 #include "apps/app_window_registry.h" | 15 #include "apps/app_window_registry.h" |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/json/json_reader.h" | 19 #include "base/json/json_reader.h" |
20 #include "base/json/json_value_converter.h" | 20 #include "base/json/json_value_converter.h" |
21 #include "base/json/json_writer.h" | 21 #include "base/json/json_writer.h" |
22 #include "base/prefs/pref_service.h" | 22 #include "base/prefs/pref_service.h" |
23 #include "base/strings/string_piece.h" | 23 #include "base/strings/string_piece.h" |
24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 27 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
28 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 28 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
29 #include "chrome/browser/chromeos/drive/test_util.h" | |
30 #include "chrome/browser/chromeos/file_manager/app_id.h" | 29 #include "chrome/browser/chromeos/file_manager/app_id.h" |
31 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" | 30 #include "chrome/browser/chromeos/file_manager/drive_test_util.h" |
32 #include "chrome/browser/chromeos/file_manager/path_util.h" | 31 #include "chrome/browser/chromeos/file_manager/path_util.h" |
33 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 32 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
34 #include "chrome/browser/chromeos/login/users/user_manager.h" | 33 #include "chrome/browser/chromeos/login/users/user_manager.h" |
35 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 34 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
36 #include "chrome/browser/drive/fake_drive_service.h" | 35 #include "chrome/browser/drive/fake_drive_service.h" |
37 #include "chrome/browser/extensions/component_loader.h" | 36 #include "chrome/browser/extensions/component_loader.h" |
38 #include "chrome/browser/extensions/extension_apitest.h" | 37 #include "chrome/browser/extensions/extension_apitest.h" |
39 #include "chrome/browser/extensions/extension_test_message_listener.h" | 38 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 base::FilePath::FromUTF8Unsafe(entry.target_path); | 348 base::FilePath::FromUTF8Unsafe(entry.target_path); |
350 const std::string target_name = path.BaseName().AsUTF8Unsafe(); | 349 const std::string target_name = path.BaseName().AsUTF8Unsafe(); |
351 | 350 |
352 // Obtain the parent entry. | 351 // Obtain the parent entry. |
353 drive::FileError error = drive::FILE_ERROR_OK; | 352 drive::FileError error = drive::FILE_ERROR_OK; |
354 scoped_ptr<drive::ResourceEntry> parent_entry(new drive::ResourceEntry); | 353 scoped_ptr<drive::ResourceEntry> parent_entry(new drive::ResourceEntry); |
355 integration_service_->file_system()->GetResourceEntry( | 354 integration_service_->file_system()->GetResourceEntry( |
356 drive::util::GetDriveMyDriveRootPath().Append(path).DirName(), | 355 drive::util::GetDriveMyDriveRootPath().Append(path).DirName(), |
357 google_apis::test_util::CreateCopyResultCallback( | 356 google_apis::test_util::CreateCopyResultCallback( |
358 &error, &parent_entry)); | 357 &error, &parent_entry)); |
359 drive::test_util::RunBlockingPoolTask(); | 358 content::RunAllBlockingPoolTasksUntilIdle(); |
360 ASSERT_EQ(drive::FILE_ERROR_OK, error); | 359 ASSERT_EQ(drive::FILE_ERROR_OK, error); |
361 ASSERT_TRUE(parent_entry); | 360 ASSERT_TRUE(parent_entry); |
362 | 361 |
363 switch (entry.type) { | 362 switch (entry.type) { |
364 case FILE: | 363 case FILE: |
365 CreateFile(entry.source_file_name, | 364 CreateFile(entry.source_file_name, |
366 parent_entry->resource_id(), | 365 parent_entry->resource_id(), |
367 target_name, | 366 target_name, |
368 entry.mime_type, | 367 entry.mime_type, |
369 entry.shared_option == SHARED, | 368 entry.shared_option == SHARED, |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 } | 1468 } |
1470 | 1469 |
1471 IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ExposureImageOnDrive) { | 1470 IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ExposureImageOnDrive) { |
1472 AddScript("gallery/photo_editor.js"); | 1471 AddScript("gallery/photo_editor.js"); |
1473 set_test_case_name("exposureImageOnDrive"); | 1472 set_test_case_name("exposureImageOnDrive"); |
1474 StartTest(); | 1473 StartTest(); |
1475 } | 1474 } |
1476 | 1475 |
1477 } // namespace | 1476 } // namespace |
1478 } // namespace file_manager | 1477 } // namespace file_manager |
OLD | NEW |