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 #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_errorcode.h" | 9 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
10 #include "chrome/browser/chromeos/gdata/gdata_files.h" | 10 #include "chrome/browser/chromeos/gdata/gdata_files.h" |
11 | 11 |
| 12 class FilePath; |
| 13 |
12 namespace gdata { | 14 namespace gdata { |
13 | 15 |
14 class GDataEntryProto; | 16 class GDataEntryProto; |
15 class GDataCacheEntry; | 17 class GDataCacheEntry; |
16 | 18 |
17 namespace test_util { | 19 namespace test_util { |
18 | 20 |
19 // Runs a task posted to the blocking pool, including subquent tasks posted | 21 // Runs a task posted to the blocking pool, including subquent tasks posted |
20 // to the UI message loop and the blocking pool. | 22 // to the UI message loop and the blocking pool. |
21 // | 23 // |
(...skipping 15 matching lines...) Expand all Loading... |
37 | 39 |
38 // Converts |cache_state| which is a bit mask of TestGDataCacheState, to a | 40 // Converts |cache_state| which is a bit mask of TestGDataCacheState, to a |
39 // GDataCacheEntry. | 41 // GDataCacheEntry. |
40 GDataCacheEntry ToCacheEntry(int cache_state); | 42 GDataCacheEntry ToCacheEntry(int cache_state); |
41 | 43 |
42 // Returns true if the cache state of the given two cache entries are equal. | 44 // Returns true if the cache state of the given two cache entries are equal. |
43 bool CacheStatesEqual(const GDataCacheEntry& a, const GDataCacheEntry& b); | 45 bool CacheStatesEqual(const GDataCacheEntry& a, const GDataCacheEntry& b); |
44 | 46 |
45 // Copies |error| to |output|. Used to run asynchronous functions that take | 47 // Copies |error| to |output|. Used to run asynchronous functions that take |
46 // FileOperationCallback from tests. | 48 // FileOperationCallback from tests. |
47 void CopyErrorCodeFromFileOperationCallback( | 49 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, |
48 GDataFileError* output, GDataFileError error); | 50 GDataFileError error); |
| 51 |
| 52 // Copies |error| and |moved_file_path| to |out_error| and |out_file_path|. |
| 53 // Used to run asynchronous functions that take FileMoveCallback from tests. |
| 54 void CopyResultsFromFileMoveCallback(GDataFileError* out_error, |
| 55 FilePath* out_file_path, |
| 56 GDataFileError error, |
| 57 const FilePath& moved_file_path); |
49 | 58 |
50 // Copies |error| and |entry_proto| to |out_error| and |out_entry_proto| | 59 // Copies |error| and |entry_proto| to |out_error| and |out_entry_proto| |
51 // respectively. Used to run asynchronous functions that take | 60 // respectively. Used to run asynchronous functions that take |
52 // GetEntryInfoCallback from tests. | 61 // GetEntryInfoCallback from tests. |
53 void CopyResultsFromGetEntryInfoCallback( | 62 void CopyResultsFromGetEntryInfoCallback( |
54 GDataFileError* out_error, | 63 GDataFileError* out_error, |
55 scoped_ptr<GDataEntryProto>* out_entry_proto, | 64 scoped_ptr<GDataEntryProto>* out_entry_proto, |
56 GDataFileError error, | 65 GDataFileError error, |
57 scoped_ptr<GDataEntryProto> entry_proto); | 66 scoped_ptr<GDataEntryProto> entry_proto); |
58 | 67 |
59 // Copies |error| and |entries| to |out_error| and |out_entries| | 68 // Copies |error| and |entries| to |out_error| and |out_entries| |
60 // respectively. Used to run asynchronous functions that take | 69 // respectively. Used to run asynchronous functions that take |
61 // GetEntryInfoCallback from tests. | 70 // GetEntryInfoCallback from tests. |
62 void CopyResultsFromReadDirectoryCallback( | 71 void CopyResultsFromReadDirectoryCallback( |
63 GDataFileError* out_error, | 72 GDataFileError* out_error, |
64 scoped_ptr<GDataEntryProtoVector>* out_entries, | 73 scoped_ptr<GDataEntryProtoVector>* out_entries, |
65 GDataFileError error, | 74 GDataFileError error, |
66 scoped_ptr<GDataEntryProtoVector> entries); | 75 scoped_ptr<GDataEntryProtoVector> entries); |
67 | 76 |
68 // Copies |result| |out_result|. Used to run asynchronous functions that take | 77 // Copies |result| |out_result|. Used to run asynchronous functions that take |
69 // GetEntryInfoPairCallback from tests. | 78 // GetEntryInfoPairCallback from tests. |
70 void CopyResultsFromGetEntryInfoPairCallback( | 79 void CopyResultsFromGetEntryInfoPairCallback( |
71 scoped_ptr<EntryInfoPairResult>* out_result, | 80 scoped_ptr<EntryInfoPairResult>* out_result, |
72 scoped_ptr<EntryInfoPairResult> result); | 81 scoped_ptr<EntryInfoPairResult> result); |
73 | 82 |
74 } // namespace test_util | 83 } // namespace test_util |
75 } // namespace gdata | 84 } // namespace gdata |
76 | 85 |
77 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ | 86 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ |
OLD | NEW |