Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(610)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_test_util.cc

Issue 10836354: Rename GData* to Drive* in gdata.proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/gdata/gdata_test_util.h" 5 #include "chrome/browser/chromeos/gdata/gdata_test_util.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 9 #include "chrome/browser/chromeos/gdata/drive.pb.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 11
12 namespace gdata { 12 namespace gdata {
13 namespace test_util { 13 namespace test_util {
14 14
15 // This class is used to monitor if any task is posted to a message loop. 15 // This class is used to monitor if any task is posted to a message loop.
16 class TaskObserver : public MessageLoop::TaskObserver { 16 class TaskObserver : public MessageLoop::TaskObserver {
17 public: 17 public:
18 TaskObserver() : posted_(false) {} 18 TaskObserver() : posted_(false) {}
19 virtual ~TaskObserver() {} 19 virtual ~TaskObserver() {}
(...skipping 18 matching lines...) Expand all
38 38
39 TaskObserver task_observer; 39 TaskObserver task_observer;
40 MessageLoop::current()->AddTaskObserver(&task_observer); 40 MessageLoop::current()->AddTaskObserver(&task_observer);
41 MessageLoop::current()->RunAllPending(); 41 MessageLoop::current()->RunAllPending();
42 MessageLoop::current()->RemoveTaskObserver(&task_observer); 42 MessageLoop::current()->RemoveTaskObserver(&task_observer);
43 if (!task_observer.posted()) 43 if (!task_observer.posted())
44 break; 44 break;
45 } 45 }
46 } 46 }
47 47
48 GDataCacheEntry ToCacheEntry(int cache_state) { 48 DriveCacheEntry ToCacheEntry(int cache_state) {
49 GDataCacheEntry cache_entry; 49 DriveCacheEntry cache_entry;
50 cache_entry.set_is_present(cache_state & TEST_CACHE_STATE_PRESENT); 50 cache_entry.set_is_present(cache_state & TEST_CACHE_STATE_PRESENT);
51 cache_entry.set_is_pinned(cache_state & TEST_CACHE_STATE_PINNED); 51 cache_entry.set_is_pinned(cache_state & TEST_CACHE_STATE_PINNED);
52 cache_entry.set_is_dirty(cache_state & TEST_CACHE_STATE_DIRTY); 52 cache_entry.set_is_dirty(cache_state & TEST_CACHE_STATE_DIRTY);
53 cache_entry.set_is_mounted(cache_state & TEST_CACHE_STATE_MOUNTED); 53 cache_entry.set_is_mounted(cache_state & TEST_CACHE_STATE_MOUNTED);
54 cache_entry.set_is_persistent(cache_state & TEST_CACHE_STATE_PERSISTENT); 54 cache_entry.set_is_persistent(cache_state & TEST_CACHE_STATE_PERSISTENT);
55 return cache_entry; 55 return cache_entry;
56 } 56 }
57 57
58 bool CacheStatesEqual(const GDataCacheEntry& a, const GDataCacheEntry& b) { 58 bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b) {
59 return (a.is_present() == b.is_present() && 59 return (a.is_present() == b.is_present() &&
60 a.is_pinned() == b.is_pinned() && 60 a.is_pinned() == b.is_pinned() &&
61 a.is_dirty() == b.is_dirty() && 61 a.is_dirty() == b.is_dirty() &&
62 a.is_mounted() == b.is_mounted() && 62 a.is_mounted() == b.is_mounted() &&
63 a.is_persistent() == b.is_persistent()); 63 a.is_persistent() == b.is_persistent());
64 } 64 }
65 65
66 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, 66 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output,
67 GDataFileError error) { 67 GDataFileError error) {
68 DCHECK(output); 68 DCHECK(output);
69 *output = error; 69 *output = error;
70 } 70 }
71 71
72 void CopyResultsFromFileMoveCallback( 72 void CopyResultsFromFileMoveCallback(
73 GDataFileError* out_error, 73 GDataFileError* out_error,
74 FilePath* out_file_path, 74 FilePath* out_file_path,
75 GDataFileError error, 75 GDataFileError error,
76 const FilePath& moved_file_path) { 76 const FilePath& moved_file_path) {
77 DCHECK(out_error); 77 DCHECK(out_error);
78 DCHECK(out_file_path); 78 DCHECK(out_file_path);
79 79
80 *out_error = error; 80 *out_error = error;
81 *out_file_path = moved_file_path; 81 *out_file_path = moved_file_path;
82 } 82 }
83 83
84 void CopyResultsFromGetEntryInfoCallback( 84 void CopyResultsFromGetEntryInfoCallback(
85 GDataFileError* out_error, 85 GDataFileError* out_error,
86 scoped_ptr<GDataEntryProto>* out_entry_proto, 86 scoped_ptr<DriveEntryProto>* out_entry_proto,
87 GDataFileError error, 87 GDataFileError error,
88 scoped_ptr<GDataEntryProto> entry_proto) { 88 scoped_ptr<DriveEntryProto> entry_proto) {
89 DCHECK(out_error); 89 DCHECK(out_error);
90 DCHECK(out_entry_proto); 90 DCHECK(out_entry_proto);
91 91
92 *out_error = error; 92 *out_error = error;
93 *out_entry_proto = entry_proto.Pass(); 93 *out_entry_proto = entry_proto.Pass();
94 } 94 }
95 95
96 void CopyResultsFromReadDirectoryCallback( 96 void CopyResultsFromReadDirectoryCallback(
97 GDataFileError* out_error, 97 GDataFileError* out_error,
98 scoped_ptr<GDataEntryProtoVector>* out_entries, 98 scoped_ptr<DriveEntryProtoVector>* out_entries,
99 GDataFileError error, 99 GDataFileError error,
100 scoped_ptr<GDataEntryProtoVector> entries) { 100 scoped_ptr<DriveEntryProtoVector> entries) {
101 DCHECK(out_error); 101 DCHECK(out_error);
102 DCHECK(out_entries); 102 DCHECK(out_entries);
103 103
104 *out_error = error; 104 *out_error = error;
105 *out_entries = entries.Pass(); 105 *out_entries = entries.Pass();
106 } 106 }
107 107
108 void CopyResultsFromGetEntryInfoWithFilePathCallback( 108 void CopyResultsFromGetEntryInfoWithFilePathCallback(
109 GDataFileError* out_error, 109 GDataFileError* out_error,
110 FilePath* out_drive_file_path, 110 FilePath* out_drive_file_path,
111 scoped_ptr<GDataEntryProto>* out_entry_proto, 111 scoped_ptr<DriveEntryProto>* out_entry_proto,
112 GDataFileError error, 112 GDataFileError error,
113 const FilePath& drive_file_path, 113 const FilePath& drive_file_path,
114 scoped_ptr<GDataEntryProto> entry_proto) { 114 scoped_ptr<DriveEntryProto> entry_proto) {
115 DCHECK(out_error); 115 DCHECK(out_error);
116 DCHECK(out_drive_file_path); 116 DCHECK(out_drive_file_path);
117 DCHECK(out_entry_proto); 117 DCHECK(out_entry_proto);
118 118
119 *out_error = error; 119 *out_error = error;
120 *out_drive_file_path = drive_file_path; 120 *out_drive_file_path = drive_file_path;
121 *out_entry_proto = entry_proto.Pass(); 121 *out_entry_proto = entry_proto.Pass();
122 } 122 }
123 123
124 void CopyResultsFromGetEntryInfoPairCallback( 124 void CopyResultsFromGetEntryInfoPairCallback(
125 scoped_ptr<EntryInfoPairResult>* out_result, 125 scoped_ptr<EntryInfoPairResult>* out_result,
126 scoped_ptr<EntryInfoPairResult> result) { 126 scoped_ptr<EntryInfoPairResult> result) {
127 DCHECK(out_result); 127 DCHECK(out_result);
128 128
129 *out_result = result.Pass(); 129 *out_result = result.Pass();
130 } 130 }
131 131
132 } // namespace test_util 132 } // namespace test_util
133 } // namespace gdata 133 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698