OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/chromeos/drive/change_list_processor.h" | 5 #include "chrome/browser/chromeos/drive/change_list_processor.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 changed_dirs = ApplyChangeList(ParseChangeList(kTestJsonDelete)); | 459 changed_dirs = ApplyChangeList(ParseChangeList(kTestJsonDelete)); |
460 EXPECT_EQ(16770, GetChangestamp()); | 460 EXPECT_EQ(16770, GetChangestamp()); |
461 EXPECT_FALSE(GetResourceEntry("drive/root/Directory 1/Added file.gdoc")); | 461 EXPECT_FALSE(GetResourceEntry("drive/root/Directory 1/Added file.gdoc")); |
462 | 462 |
463 EXPECT_EQ(1U, changed_dirs.size()); | 463 EXPECT_EQ(1U, changed_dirs.size()); |
464 EXPECT_TRUE(changed_dirs.count( | 464 EXPECT_TRUE(changed_dirs.count( |
465 base::FilePath::FromUTF8Unsafe("drive/root/Directory 1"))); | 465 base::FilePath::FromUTF8Unsafe("drive/root/Directory 1"))); |
466 } | 466 } |
467 | 467 |
468 TEST_F(ChangeListProcessorTest, DeltaAddFileToNewButDeletedDirectory) { | 468 TEST_F(ChangeListProcessorTest, DeltaAddFileToNewButDeletedDirectory) { |
469 // This feed contains the following updates: | 469 // This file contains the following updates: |
470 // 1) A new PDF file is added to a new directory | 470 // 1) A new PDF file is added to a new directory |
471 // 2) but the new directory is marked "deleted" (i.e. moved to Trash) | 471 // 2) but the new directory is marked "deleted" (i.e. moved to Trash) |
472 // Hence, the PDF file should be just ignored. | 472 // Hence, the PDF file should be just ignored. |
473 const char kTestJson[] = | 473 const char kTestJson[] = |
474 "chromeos/gdata/delta_file_added_in_new_but_deleted_directory.json"; | 474 "chromeos/gdata/delta_file_added_in_new_but_deleted_directory.json"; |
475 | 475 |
476 ChangeListProcessor::ResourceEntryMap entry_map; | 476 ChangeListProcessor::ResourceEntryMap entry_map; |
477 ChangeListProcessor::ConvertToMap( | 477 ChangeListProcessor::ConvertToMap( |
478 ParseChangeList(kTestJson), &entry_map, NULL); | 478 ParseChangeList(kTestJson), &entry_map, NULL); |
479 | 479 |
(...skipping 14 matching lines...) Expand all Loading... |
494 ApplyChangeList(ParseChangeList(kTestJson)); | 494 ApplyChangeList(ParseChangeList(kTestJson)); |
495 | 495 |
496 EXPECT_EQ(16730, GetChangestamp()); // the value is written in kTestJson. | 496 EXPECT_EQ(16730, GetChangestamp()); // the value is written in kTestJson. |
497 EXPECT_FALSE(GetResourceEntry("drive/root/New Directory/new_pdf_file.pdf")); | 497 EXPECT_FALSE(GetResourceEntry("drive/root/New Directory/new_pdf_file.pdf")); |
498 | 498 |
499 EXPECT_TRUE(changed_dirs.empty()); | 499 EXPECT_TRUE(changed_dirs.empty()); |
500 } | 500 } |
501 | 501 |
502 } // namespace internal | 502 } // namespace internal |
503 } // namespace drive | 503 } // namespace drive |
OLD | NEW |