| 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/drive_resource_metadata.h" | 9 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" |
| 10 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 10 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // 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 |
| 24 // to the UI message loop and the blocking pool. | 24 // to the UI message loop and the blocking pool. |
| 25 // | 25 // |
| 26 // 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 |
| 27 // 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 |
| 28 // 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 |
| 29 // repeatedly. | 29 // repeatedly. |
| 30 void RunBlockingPoolTask(); | 30 void RunBlockingPoolTask(); |
| 31 | 31 |
| 32 // This is a bitmask of cache states in DriveCacheEntry. Used only in tests. | 32 // This is a bitmask of cache states in DriveCacheEntry. Used only in tests. |
| 33 enum TestGDataCacheState { | 33 enum TestDriveCacheState { |
| 34 TEST_CACHE_STATE_NONE = 0, | 34 TEST_CACHE_STATE_NONE = 0, |
| 35 TEST_CACHE_STATE_PINNED = 1 << 0, | 35 TEST_CACHE_STATE_PINNED = 1 << 0, |
| 36 TEST_CACHE_STATE_PRESENT = 1 << 1, | 36 TEST_CACHE_STATE_PRESENT = 1 << 1, |
| 37 TEST_CACHE_STATE_DIRTY = 1 << 2, | 37 TEST_CACHE_STATE_DIRTY = 1 << 2, |
| 38 TEST_CACHE_STATE_MOUNTED = 1 << 3, | 38 TEST_CACHE_STATE_MOUNTED = 1 << 3, |
| 39 TEST_CACHE_STATE_PERSISTENT = 1 << 4, | 39 TEST_CACHE_STATE_PERSISTENT = 1 << 4, |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Converts |cache_state| which is a bit mask of TestGDataCacheState, to a | 42 // Converts |cache_state| which is a bit mask of TestDriveCacheState, to a |
| 43 // DriveCacheEntry. | 43 // DriveCacheEntry. |
| 44 DriveCacheEntry ToCacheEntry(int cache_state); | 44 DriveCacheEntry ToCacheEntry(int cache_state); |
| 45 | 45 |
| 46 // 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. |
| 47 bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b); | 47 bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b); |
| 48 | 48 |
| 49 // Copies |error| to |output|. Used to run asynchronous functions that take | 49 // Copies |error| to |output|. Used to run asynchronous functions that take |
| 50 // FileOperationCallback from tests. | 50 // FileOperationCallback from tests. |
| 51 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, | 51 void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, |
| 52 GDataFileError error); | 52 GDataFileError error); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Copies |result| to |out_result|. Used to run asynchronous functions | 91 // Copies |result| to |out_result|. Used to run asynchronous functions |
| 92 // that take GetEntryInfoPairCallback from tests. | 92 // that take GetEntryInfoPairCallback from tests. |
| 93 void CopyResultsFromGetEntryInfoPairCallback( | 93 void CopyResultsFromGetEntryInfoPairCallback( |
| 94 scoped_ptr<EntryInfoPairResult>* out_result, | 94 scoped_ptr<EntryInfoPairResult>* out_result, |
| 95 scoped_ptr<EntryInfoPairResult> result); | 95 scoped_ptr<EntryInfoPairResult> result); |
| 96 | 96 |
| 97 } // namespace test_util | 97 } // namespace test_util |
| 98 } // namespace gdata | 98 } // namespace gdata |
| 99 | 99 |
| 100 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ | 100 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_TEST_UTIL_H_ |
| OLD | NEW |