| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drive_test_util.h" | 5 #include "chrome/browser/chromeos/drive/drive_test_util.h" |
| 6 | 6 |
| 7 #include "base/json/json_file_value_serializer.h" | 7 #include "base/json/json_file_value_serializer.h" |
| 8 #include "chrome/browser/chromeos/drive/drive.pb.h" | 8 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 9 #include "chrome/browser/chromeos/drive/drive_file_system.h" | 9 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
| 10 #include "chrome/browser/google_apis/drive_api_parser.h" | 10 #include "chrome/browser/google_apis/drive_api_parser.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace gdata { | 13 namespace drive { |
| 14 namespace test_util { | 14 namespace test_util { |
| 15 | 15 |
| 16 DriveCacheEntry ToCacheEntry(int cache_state) { | 16 DriveCacheEntry ToCacheEntry(int cache_state) { |
| 17 DriveCacheEntry cache_entry; | 17 DriveCacheEntry cache_entry; |
| 18 cache_entry.set_is_present(cache_state & TEST_CACHE_STATE_PRESENT); | 18 cache_entry.set_is_present(cache_state & TEST_CACHE_STATE_PRESENT); |
| 19 cache_entry.set_is_pinned(cache_state & TEST_CACHE_STATE_PINNED); | 19 cache_entry.set_is_pinned(cache_state & TEST_CACHE_STATE_PINNED); |
| 20 cache_entry.set_is_dirty(cache_state & TEST_CACHE_STATE_DIRTY); | 20 cache_entry.set_is_dirty(cache_state & TEST_CACHE_STATE_DIRTY); |
| 21 cache_entry.set_is_mounted(cache_state & TEST_CACHE_STATE_MOUNTED); | 21 cache_entry.set_is_mounted(cache_state & TEST_CACHE_STATE_MOUNTED); |
| 22 cache_entry.set_is_persistent(cache_state & TEST_CACHE_STATE_PERSISTENT); | 22 cache_entry.set_is_persistent(cache_state & TEST_CACHE_STATE_PERSISTENT); |
| 23 return cache_entry; | 23 return cache_entry; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool success) { | 101 bool success) { |
| 102 DCHECK(out_success); | 102 DCHECK(out_success); |
| 103 *out_success = success; | 103 *out_success = success; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void LoadChangeFeed(const std::string& relative_path, | 106 void LoadChangeFeed(const std::string& relative_path, |
| 107 DriveFileSystem* file_system, | 107 DriveFileSystem* file_system, |
| 108 int64 start_changestamp, | 108 int64 start_changestamp, |
| 109 int64 root_feed_changestamp) { | 109 int64 root_feed_changestamp) { |
| 110 std::string error; | 110 std::string error; |
| 111 scoped_ptr<Value> document = test_util::LoadJSONFile(relative_path); | 111 scoped_ptr<Value> document = gdata::test_util::LoadJSONFile(relative_path); |
| 112 ASSERT_TRUE(document.get()); | 112 ASSERT_TRUE(document.get()); |
| 113 ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); | 113 ASSERT_TRUE(document->GetType() == Value::TYPE_DICTIONARY); |
| 114 scoped_ptr<DocumentFeed> document_feed( | 114 scoped_ptr<gdata::DocumentFeed> document_feed( |
| 115 DocumentFeed::ExtractAndParse(*document)); | 115 gdata::DocumentFeed::ExtractAndParse(*document)); |
| 116 ASSERT_TRUE(document_feed.get()); | 116 ASSERT_TRUE(document_feed.get()); |
| 117 ScopedVector<DocumentFeed> feed_list; | 117 ScopedVector<gdata::DocumentFeed> feed_list; |
| 118 feed_list.push_back(document_feed.release()); | 118 feed_list.push_back(document_feed.release()); |
| 119 | 119 |
| 120 GURL unused; | 120 GURL unused; |
| 121 DriveFileError file_error = file_system->UpdateFromFeedForTesting( | 121 DriveFileError file_error = file_system->UpdateFromFeedForTesting( |
| 122 feed_list, | 122 feed_list, |
| 123 start_changestamp, | 123 start_changestamp, |
| 124 root_feed_changestamp); | 124 root_feed_changestamp); |
| 125 ASSERT_EQ(DRIVE_FILE_OK, file_error); | 125 ASSERT_EQ(DRIVE_FILE_OK, file_error); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace test_util | 128 } // namespace test_util |
| 129 } // namespace gdata | 129 } // namespace drive |
| OLD | NEW |