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

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

Issue 10836354: Rename GData* to Drive* in gdata.proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for comments. 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h" 9 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h"
10 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 10 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
11 11
12 class FilePath; 12 class FilePath;
13 13
14 namespace gdata { 14 namespace gdata {
15 15
16 class GDataEntryProto; 16 class DriveCacheEntry;
17 class GDataCacheEntry; 17 class DriveEntryProto;
18
19 typedef std::vector<DriveEntryProto> DriveEntryProtoVector;
18 20
19 namespace test_util { 21 namespace test_util {
20 22
21 // Runs a task posted to the blocking pool, including subquent tasks posted 23 // Runs a task posted to the blocking pool, including subquent tasks posted
22 // to the UI message loop and the blocking pool. 24 // to the UI message loop and the blocking pool.
23 // 25 //
24 // A task is often posted to the blocking pool with PostTaskAndReply(). In 26 // A task is often posted to the blocking pool with PostTaskAndReply(). In
25 // that case, a task is posted back to the UI message loop, which can again 27 // that case, a task is posted back to the UI message loop, which can again
26 // post a task to the blocking pool. This function processes these tasks 28 // post a task to the blocking pool. This function processes these tasks
27 // repeatedly. 29 // repeatedly.
28 void RunBlockingPoolTask(); 30 void RunBlockingPoolTask();
29 31
30 // This is a bitmask of cache states in GDataCacheEntry. Used only in tests. 32 // This is a bitmask of cache states in DriveCacheEntry. Used only in tests.
31 enum TestGDataCacheState { 33 enum TestGDataCacheState {
32 TEST_CACHE_STATE_NONE = 0, 34 TEST_CACHE_STATE_NONE = 0,
33 TEST_CACHE_STATE_PINNED = 1 << 0, 35 TEST_CACHE_STATE_PINNED = 1 << 0,
34 TEST_CACHE_STATE_PRESENT = 1 << 1, 36 TEST_CACHE_STATE_PRESENT = 1 << 1,
35 TEST_CACHE_STATE_DIRTY = 1 << 2, 37 TEST_CACHE_STATE_DIRTY = 1 << 2,
36 TEST_CACHE_STATE_MOUNTED = 1 << 3, 38 TEST_CACHE_STATE_MOUNTED = 1 << 3,
37 TEST_CACHE_STATE_PERSISTENT = 1 << 4, 39 TEST_CACHE_STATE_PERSISTENT = 1 << 4,
38 }; 40 };
39 41
40 // Converts |cache_state| which is a bit mask of TestGDataCacheState, to a 42 // Converts |cache_state| which is a bit mask of TestGDataCacheState, to a
41 // GDataCacheEntry. 43 // DriveCacheEntry.
42 GDataCacheEntry ToCacheEntry(int cache_state); 44 DriveCacheEntry ToCacheEntry(int cache_state);
43 45
44 // Returns true if the cache state of the given two cache entries are equal. 46 // Returns true if the cache state of the given two cache entries are equal.
45 bool CacheStatesEqual(const GDataCacheEntry& a, const GDataCacheEntry& b); 47 bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b);
46 48
47 // Copies |error| to |output|. Used to run asynchronous functions that take 49 // Copies |error| to |output|. Used to run asynchronous functions that take
48 // FileOperationCallback from tests. 50 // FileOperationCallback from tests.
49 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, 51 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output,
50 GDataFileError error); 52 GDataFileError error);
51 53
52 // Copies |error| and |moved_file_path| to |out_error| and |out_file_path|. 54 // Copies |error| and |moved_file_path| to |out_error| and |out_file_path|.
53 // Used to run asynchronous functions that take FileMoveCallback from tests. 55 // Used to run asynchronous functions that take FileMoveCallback from tests.
54 void CopyResultsFromFileMoveCallback(GDataFileError* out_error, 56 void CopyResultsFromFileMoveCallback(GDataFileError* out_error,
55 FilePath* out_file_path, 57 FilePath* out_file_path,
56 GDataFileError error, 58 GDataFileError error,
57 const FilePath& moved_file_path); 59 const FilePath& moved_file_path);
58 60
59 // Copies |error| and |entry_proto| to |out_error| and |out_entry_proto| 61 // Copies |error| and |entry_proto| to |out_error| and |out_entry_proto|
60 // respectively. Used to run asynchronous functions that take 62 // respectively. Used to run asynchronous functions that take
61 // GetEntryInfoCallback from tests. 63 // GetEntryInfoCallback from tests.
62 void CopyResultsFromGetEntryInfoCallback( 64 void CopyResultsFromGetEntryInfoCallback(
63 GDataFileError* out_error, 65 GDataFileError* out_error,
64 scoped_ptr<GDataEntryProto>* out_entry_proto, 66 scoped_ptr<DriveEntryProto>* out_entry_proto,
65 GDataFileError error, 67 GDataFileError error,
66 scoped_ptr<GDataEntryProto> entry_proto); 68 scoped_ptr<DriveEntryProto> entry_proto);
67 69
68 // Copies |error| and |entries| to |out_error| and |out_entries| 70 // Copies |error| and |entries| to |out_error| and |out_entries|
69 // respectively. Used to run asynchronous functions that take 71 // respectively. Used to run asynchronous functions that take
70 // GetEntryInfoCallback from tests. 72 // GetEntryInfoCallback from tests.
71 void CopyResultsFromReadDirectoryCallback( 73 void CopyResultsFromReadDirectoryCallback(
72 GDataFileError* out_error, 74 GDataFileError* out_error,
73 scoped_ptr<GDataEntryProtoVector>* out_entries, 75 scoped_ptr<DriveEntryProtoVector>* out_entries,
74 GDataFileError error, 76 GDataFileError error,
75 scoped_ptr<GDataEntryProtoVector> entries); 77 scoped_ptr<DriveEntryProtoVector> entries);
76 78
77 // Copies |error|, |drive_file_path|, and |entry_proto| to |out_error|, 79 // Copies |error|, |drive_file_path|, and |entry_proto| to |out_error|,
78 // |out_drive_file_path|, and |out_entry_proto| respectively. Used to run 80 // |out_drive_file_path|, and |out_entry_proto| respectively. Used to run
79 // asynchronous functions that take GetEntryInfoWithFilePathCallback from 81 // asynchronous functions that take GetEntryInfoWithFilePathCallback from
80 // tests. 82 // tests.
81 void CopyResultsFromGetEntryInfoWithFilePathCallback( 83 void CopyResultsFromGetEntryInfoWithFilePathCallback(
82 GDataFileError* out_error, 84 GDataFileError* out_error,
83 FilePath* out_drive_file_path, 85 FilePath* out_drive_file_path,
84 scoped_ptr<GDataEntryProto>* out_entry_proto, 86 scoped_ptr<DriveEntryProto>* out_entry_proto,
85 GDataFileError error, 87 GDataFileError error,
86 const FilePath& drive_file_path, 88 const FilePath& drive_file_path,
87 scoped_ptr<GDataEntryProto> entry_proto); 89 scoped_ptr<DriveEntryProto> entry_proto);
88 90
89 // Copies |result| to |out_result|. Used to run asynchronous functions 91 // Copies |result| to |out_result|. Used to run asynchronous functions
90 // that take GetEntryInfoPairCallback from tests. 92 // that take GetEntryInfoPairCallback from tests.
91 void CopyResultsFromGetEntryInfoPairCallback( 93 void CopyResultsFromGetEntryInfoPairCallback(
92 scoped_ptr<EntryInfoPairResult>* out_result, 94 scoped_ptr<EntryInfoPairResult>* out_result,
93 scoped_ptr<EntryInfoPairResult> result); 95 scoped_ptr<EntryInfoPairResult> result);
94 96
95 } // namespace test_util 97 } // namespace test_util
96 } // namespace gdata 98 } // namespace gdata
97 99
98 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ 100 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc ('k') | chrome/browser/chromeos/gdata/gdata_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698