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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // Creates an empty directory with the given |name| and |modification_time|. | 210 // Creates an empty directory with the given |name| and |modification_time|. |
211 void CreateDirectory(const std::string& name, | 211 void CreateDirectory(const std::string& name, |
212 const std::string& modification_time) { | 212 const std::string& modification_time) { |
213 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 213 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; |
214 scoped_ptr<google_apis::ResourceEntry> resource_entry; | 214 scoped_ptr<google_apis::ResourceEntry> resource_entry; |
215 fake_drive_service_->AddNewDirectory( | 215 fake_drive_service_->AddNewDirectory( |
216 fake_drive_service_->GetRootResourceId(), | 216 fake_drive_service_->GetRootResourceId(), |
217 name, | 217 name, |
218 google_apis::test_util::CreateCopyResultCallback(&error, | 218 google_apis::test_util::CreateCopyResultCallback(&error, |
219 &resource_entry)); | 219 &resource_entry)); |
220 MessageLoop::current()->RunUntilIdle(); | 220 base::MessageLoop::current()->RunUntilIdle(); |
221 ASSERT_TRUE(error == google_apis::HTTP_CREATED); | 221 ASSERT_TRUE(error == google_apis::HTTP_CREATED); |
222 ASSERT_TRUE(resource_entry); | 222 ASSERT_TRUE(resource_entry); |
223 | 223 |
224 base::Time time; | 224 base::Time time; |
225 ASSERT_TRUE(base::Time::FromString(modification_time.c_str(), &time)); | 225 ASSERT_TRUE(base::Time::FromString(modification_time.c_str(), &time)); |
226 fake_drive_service_->SetLastModifiedTime( | 226 fake_drive_service_->SetLastModifiedTime( |
227 resource_entry->resource_id(), | 227 resource_entry->resource_id(), |
228 time, | 228 time, |
229 google_apis::test_util::CreateCopyResultCallback(&error, | 229 google_apis::test_util::CreateCopyResultCallback(&error, |
230 &resource_entry)); | 230 &resource_entry)); |
231 MessageLoop::current()->RunUntilIdle(); | 231 base::MessageLoop::current()->RunUntilIdle(); |
232 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); | 232 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); |
233 ASSERT_TRUE(resource_entry); | 233 ASSERT_TRUE(resource_entry); |
234 CheckForUpdates(); | 234 CheckForUpdates(); |
235 } | 235 } |
236 | 236 |
237 virtual std::string GetName() const OVERRIDE { | 237 virtual std::string GetName() const OVERRIDE { |
238 return "Drive"; | 238 return "Drive"; |
239 } | 239 } |
240 | 240 |
241 // Creates a test file with the given spec. | 241 // Creates a test file with the given spec. |
(...skipping 15 matching lines...) Expand all Loading... |
257 | 257 |
258 scoped_ptr<google_apis::ResourceEntry> resource_entry; | 258 scoped_ptr<google_apis::ResourceEntry> resource_entry; |
259 fake_drive_service_->AddNewFile( | 259 fake_drive_service_->AddNewFile( |
260 mime_type, | 260 mime_type, |
261 content_data, | 261 content_data, |
262 fake_drive_service_->GetRootResourceId(), | 262 fake_drive_service_->GetRootResourceId(), |
263 target_file_name, | 263 target_file_name, |
264 shared_with_me, | 264 shared_with_me, |
265 google_apis::test_util::CreateCopyResultCallback(&error, | 265 google_apis::test_util::CreateCopyResultCallback(&error, |
266 &resource_entry)); | 266 &resource_entry)); |
267 MessageLoop::current()->RunUntilIdle(); | 267 base::MessageLoop::current()->RunUntilIdle(); |
268 ASSERT_EQ(google_apis::HTTP_CREATED, error); | 268 ASSERT_EQ(google_apis::HTTP_CREATED, error); |
269 ASSERT_TRUE(resource_entry); | 269 ASSERT_TRUE(resource_entry); |
270 | 270 |
271 base::Time time; | 271 base::Time time; |
272 ASSERT_TRUE(base::Time::FromString(modification_time.c_str(), &time)); | 272 ASSERT_TRUE(base::Time::FromString(modification_time.c_str(), &time)); |
273 fake_drive_service_->SetLastModifiedTime( | 273 fake_drive_service_->SetLastModifiedTime( |
274 resource_entry->resource_id(), | 274 resource_entry->resource_id(), |
275 time, | 275 time, |
276 google_apis::test_util::CreateCopyResultCallback(&error, | 276 google_apis::test_util::CreateCopyResultCallback(&error, |
277 &resource_entry)); | 277 &resource_entry)); |
278 MessageLoop::current()->RunUntilIdle(); | 278 base::MessageLoop::current()->RunUntilIdle(); |
279 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); | 279 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); |
280 ASSERT_TRUE(resource_entry); | 280 ASSERT_TRUE(resource_entry); |
281 | 281 |
282 CheckForUpdates(); | 282 CheckForUpdates(); |
283 } | 283 } |
284 | 284 |
285 // Notifies FileSystem that the contents in FakeDriveService are | 285 // Notifies FileSystem that the contents in FakeDriveService are |
286 // changed, hence the new contents should be fetched. | 286 // changed, hence the new contents should be fetched. |
287 void CheckForUpdates() { | 287 void CheckForUpdates() { |
288 if (integration_service_ && integration_service_->file_system()) { | 288 if (integration_service_ && integration_service_->file_system()) { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 } | 600 } |
601 | 601 |
602 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | 602 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, |
603 TransferFromOfflineToDrive) { | 603 TransferFromOfflineToDrive) { |
604 ResultCatcher catcher; | 604 ResultCatcher catcher; |
605 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromOfflineToDrive")); | 605 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromOfflineToDrive")); |
606 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 606 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
607 } | 607 } |
608 | 608 |
609 } // namespace | 609 } // namespace |
OLD | NEW |