Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_ | |
| 6 #define WEBKIT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "storage/browser/fileapi/file_observers.h" | |
| 13 #include "storage/browser/fileapi/file_system_url.h" | |
| 14 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" | |
| 15 | |
| 16 namespace storage { | |
| 17 | |
| 18 // Mock file change observer. | |
| 19 class MockFileUpdateObserver : public FileUpdateObserver { | |
| 20 public: | |
| 21 MockFileUpdateObserver(); | |
| 22 virtual ~MockFileUpdateObserver(); | |
| 23 | |
| 24 // Creates a ChangeObserverList which only contains given |observer|. | |
| 25 static UpdateObserverList CreateList(MockFileUpdateObserver* observer); | |
| 26 | |
| 27 // FileUpdateObserver overrides. | |
| 28 virtual void OnStartUpdate(const FileSystemURL& url) OVERRIDE; | |
| 29 virtual void OnUpdate(const FileSystemURL& url, int64 delta) OVERRIDE; | |
| 30 virtual void OnEndUpdate(const FileSystemURL& url) OVERRIDE; | |
| 31 | |
| 32 void StartCount() { | |
| 33 is_ready_ = true; | |
| 34 } | |
| 35 | |
| 36 void EndCount() { | |
| 37 start_update_count_.clear(); | |
| 38 end_update_count_.clear(); | |
| 39 is_ready_ = false; | |
| 40 } | |
| 41 | |
| 42 private: | |
| 43 std::map<base::FilePath::StringType, int> start_update_count_; | |
|
tzik
2014/09/19 03:44:00
Can we just use FileSystemURL instead of FilePath?
iseki
2014/09/19 04:55:29
Done.
| |
| 44 std::map<base::FilePath::StringType, int> end_update_count_; | |
| 45 bool is_ready_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(MockFileUpdateObserver); | |
| 48 }; | |
| 49 | |
| 50 } // namespace storage | |
| 51 | |
| 52 #endif // WEBKIT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_ | |
| OLD | NEW |