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