| 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/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 metadata_storage_.reset(new ResourceMetadataStorage( | 45 metadata_storage_.reset(new ResourceMetadataStorage( |
| 46 temp_dir_.path(), base::MessageLoopProxy::current())); | 46 temp_dir_.path(), base::MessageLoopProxy::current())); |
| 47 ASSERT_TRUE(metadata_storage_->Initialize()); | 47 ASSERT_TRUE(metadata_storage_->Initialize()); |
| 48 | 48 |
| 49 metadata_.reset(new internal::ResourceMetadata( | 49 metadata_.reset(new internal::ResourceMetadata( |
| 50 metadata_storage_.get(), base::MessageLoopProxy::current())); | 50 metadata_storage_.get(), base::MessageLoopProxy::current())); |
| 51 ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize()); | 51 ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void TearDown() OVERRIDE { | |
| 55 metadata_.reset(); | |
| 56 } | |
| 57 | |
| 58 // Parses a json file at |test_data_path| relative to Chrome test directory | 54 // Parses a json file at |test_data_path| relative to Chrome test directory |
| 59 // into a ScopedVector<drive::internal::ChangeList>. | 55 // into a ScopedVector<drive::internal::ChangeList>. |
| 60 ScopedVector<ChangeList> ParseChangeList(const std::string& test_data_path) { | 56 ScopedVector<ChangeList> ParseChangeList(const std::string& test_data_path) { |
| 61 ScopedVector<ChangeList> changes; | 57 ScopedVector<ChangeList> changes; |
| 62 changes.push_back(new ChangeList( | 58 changes.push_back(new ChangeList( |
| 63 *google_apis::ResourceList::ExtractAndParse( | 59 *google_apis::ResourceList::ExtractAndParse( |
| 64 *google_apis::test_util::LoadJSONFile( | 60 *google_apis::test_util::LoadJSONFile( |
| 65 test_data_path)))); | 61 test_data_path)))); |
| 66 return changes.Pass(); | 62 return changes.Pass(); |
| 67 } | 63 } |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 449 |
| 454 // The value is written in kTestJson. | 450 // The value is written in kTestJson. |
| 455 EXPECT_EQ(16730, metadata_->GetLargestChangestamp()); | 451 EXPECT_EQ(16730, metadata_->GetLargestChangestamp()); |
| 456 EXPECT_FALSE(GetResourceEntry("drive/root/New Directory/new_pdf_file.pdf")); | 452 EXPECT_FALSE(GetResourceEntry("drive/root/New Directory/new_pdf_file.pdf")); |
| 457 | 453 |
| 458 EXPECT_TRUE(changed_dirs.empty()); | 454 EXPECT_TRUE(changed_dirs.empty()); |
| 459 } | 455 } |
| 460 | 456 |
| 461 } // namespace internal | 457 } // namespace internal |
| 462 } // namespace drive | 458 } // namespace drive |
| OLD | NEW |