| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/extensions/extension_test_message_listener.h" | 27 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 28 #include "chrome/browser/google_apis/gdata_wapi_parser.h" | 28 #include "chrome/browser/google_apis/gdata_wapi_parser.h" |
| 29 #include "chrome/browser/google_apis/test_util.h" | 29 #include "chrome/browser/google_apis/test_util.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/extensions/extension.h" | 32 #include "chrome/common/extensions/extension.h" |
| 33 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
| 34 #include "content/public/browser/browser_context.h" | 34 #include "content/public/browser/browser_context.h" |
| 35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 36 #include "content/public/test/test_utils.h" | 36 #include "content/public/test/test_utils.h" |
| 37 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 37 #include "webkit/browser/fileapi/external_mount_points.h" | 38 #include "webkit/browser/fileapi/external_mount_points.h" |
| 38 | 39 |
| 39 namespace file_manager { | 40 namespace file_manager { |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| 42 enum EntryType { | 43 enum EntryType { |
| 43 FILE, | 44 FILE, |
| 44 DIRECTORY, | 45 DIRECTORY, |
| 45 }; | 46 }; |
| 46 | 47 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 249 } |
| 249 | 250 |
| 250 // Notifies FileSystem that the contents in FakeDriveService are | 251 // Notifies FileSystem that the contents in FakeDriveService are |
| 251 // changed, hence the new contents should be fetched. | 252 // changed, hence the new contents should be fetched. |
| 252 void CheckForUpdates() { | 253 void CheckForUpdates() { |
| 253 if (integration_service_ && integration_service_->file_system()) { | 254 if (integration_service_ && integration_service_->file_system()) { |
| 254 integration_service_->file_system()->CheckForUpdates(); | 255 integration_service_->file_system()->CheckForUpdates(); |
| 255 } | 256 } |
| 256 } | 257 } |
| 257 | 258 |
| 259 // Sets the url base for the test server to be used to generate share urls |
| 260 // on the files and directories. |
| 261 void ConfigureShareUrlBase(const GURL& share_url_base) { |
| 262 fake_drive_service_->set_share_url_base(share_url_base); |
| 263 } |
| 264 |
| 258 drive::DriveIntegrationService* CreateDriveIntegrationService( | 265 drive::DriveIntegrationService* CreateDriveIntegrationService( |
| 259 Profile* profile) { | 266 Profile* profile) { |
| 260 fake_drive_service_ = new drive::FakeDriveService; | 267 fake_drive_service_ = new drive::FakeDriveService; |
| 261 fake_drive_service_->LoadResourceListForWapi( | 268 fake_drive_service_->LoadResourceListForWapi( |
| 262 "gdata/empty_feed.json"); | 269 "gdata/empty_feed.json"); |
| 263 fake_drive_service_->LoadAccountMetadataForWapi( | 270 fake_drive_service_->LoadAccountMetadataForWapi( |
| 264 "gdata/account_metadata.json"); | 271 "gdata/account_metadata.json"); |
| 265 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); | 272 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); |
| 266 integration_service_ = new drive::DriveIntegrationService( | 273 integration_service_ = new drive::DriveIntegrationService( |
| 267 profile, | 274 profile, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 370 } |
| 364 | 371 |
| 365 void FileManagerBrowserTest::SetUpOnMainThread() { | 372 void FileManagerBrowserTest::SetUpOnMainThread() { |
| 366 ExtensionApiTest::SetUpOnMainThread(); | 373 ExtensionApiTest::SetUpOnMainThread(); |
| 367 ASSERT_TRUE(local_volume_->Mount(browser()->profile())); | 374 ASSERT_TRUE(local_volume_->Mount(browser()->profile())); |
| 368 | 375 |
| 369 for (size_t i = 0; i < arraysize(kTestEntrySetCommon); ++i) | 376 for (size_t i = 0; i < arraysize(kTestEntrySetCommon); ++i) |
| 370 local_volume_->CreateEntry(kTestEntrySetCommon[i]); | 377 local_volume_->CreateEntry(kTestEntrySetCommon[i]); |
| 371 | 378 |
| 372 if (drive_volume_) { | 379 if (drive_volume_) { |
| 380 // Install the web server to serve the mocked share dialog. |
| 381 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 382 const GURL share_url_base(embedded_test_server()->GetURL( |
| 383 "/chromeos/file_manager/share_dialog_mock/index.html")); |
| 384 drive_volume_->ConfigureShareUrlBase(share_url_base); |
| 385 |
| 373 for (size_t i = 0; i < arraysize(kTestEntrySetCommon); ++i) | 386 for (size_t i = 0; i < arraysize(kTestEntrySetCommon); ++i) |
| 374 drive_volume_->CreateEntry(kTestEntrySetCommon[i]); | 387 drive_volume_->CreateEntry(kTestEntrySetCommon[i]); |
| 375 | 388 |
| 376 // For testing Drive, create more entries with Drive specific attributes. | 389 // For testing Drive, create more entries with Drive specific attributes. |
| 377 // TODO(haruki): Add a case for an entry cached by DriveCache. | 390 // TODO(haruki): Add a case for an entry cached by DriveCache. |
| 378 for (size_t i = 0; i < arraysize(kTestEntrySetDriveOnly); ++i) | 391 for (size_t i = 0; i < arraysize(kTestEntrySetDriveOnly); ++i) |
| 379 drive_volume_->CreateEntry(kTestEntrySetDriveOnly[i]); | 392 drive_volume_->CreateEntry(kTestEntrySetDriveOnly[i]); |
| 380 | 393 |
| 381 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); | 394 test_util::WaitUntilDriveMountPointIsAdded(browser()->profile()); |
| 382 } | 395 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 TestParameter(NOT_IN_GUEST_MODE, "hideSearchBox"))); | 515 TestParameter(NOT_IN_GUEST_MODE, "hideSearchBox"))); |
| 503 | 516 |
| 504 INSTANTIATE_TEST_CASE_P( | 517 INSTANTIATE_TEST_CASE_P( |
| 505 RestorePrefs, | 518 RestorePrefs, |
| 506 FileManagerBrowserTest, | 519 FileManagerBrowserTest, |
| 507 ::testing::Values(TestParameter(IN_GUEST_MODE, "restoreSortColumn"), | 520 ::testing::Values(TestParameter(IN_GUEST_MODE, "restoreSortColumn"), |
| 508 TestParameter(NOT_IN_GUEST_MODE, "restoreSortColumn"), | 521 TestParameter(NOT_IN_GUEST_MODE, "restoreSortColumn"), |
| 509 TestParameter(IN_GUEST_MODE, "restoreCurrentView"), | 522 TestParameter(IN_GUEST_MODE, "restoreCurrentView"), |
| 510 TestParameter(NOT_IN_GUEST_MODE, "restoreCurrentView"))); | 523 TestParameter(NOT_IN_GUEST_MODE, "restoreCurrentView"))); |
| 511 | 524 |
| 525 INSTANTIATE_TEST_CASE_P( |
| 526 ShareDialog, |
| 527 FileManagerBrowserTest, |
| 528 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "shareFile"), |
| 529 TestParameter(NOT_IN_GUEST_MODE, "shareDirectory"))); |
| 530 |
| 512 } // namespace | 531 } // namespace |
| 513 } // namespace file_manager | 532 } // namespace file_manager |
| OLD | NEW |