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

Side by Side Diff: webkit/fileapi/mock_file_change_observer.h

Issue 15994002: Move more browser-specific webkit/fileapi code to webkit/browser/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_FILEAPI_MOCK_FILE_CHANGE_OBSERVER_H_
6 #define WEBKIT_FILEAPI_MOCK_FILE_CHANGE_OBSERVER_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "webkit/fileapi/file_observers.h"
11 #include "webkit/fileapi/file_system_url.h"
12 #include "webkit/fileapi/task_runner_bound_observer_list.h"
13
14 namespace fileapi {
15
16 // Mock file change observer.
17 class MockFileChangeObserver : public FileChangeObserver {
18 public:
19 MockFileChangeObserver();
20 virtual ~MockFileChangeObserver();
21
22 // Creates a ChangeObserverList which only contains given |observer|.
23 static ChangeObserverList CreateList(MockFileChangeObserver* observer);
24
25 // FileChangeObserver overrides.
26 virtual void OnCreateFile(const FileSystemURL& url) OVERRIDE;
27 virtual void OnCreateFileFrom(const FileSystemURL& url,
28 const FileSystemURL& src) OVERRIDE;
29 virtual void OnRemoveFile(const FileSystemURL& url) OVERRIDE;
30 virtual void OnModifyFile(const FileSystemURL& url) OVERRIDE;
31 virtual void OnCreateDirectory(const FileSystemURL& url) OVERRIDE;
32 virtual void OnRemoveDirectory(const FileSystemURL& url) OVERRIDE;
33
34 void ResetCount() {
35 create_file_count_ = 0;
36 create_file_from_count_ = 0;
37 remove_file_count_ = 0;
38 modify_file_count_ = 0;
39 create_directory_count_ = 0;
40 remove_directory_count_ = 0;
41 }
42
43 bool HasNoChange() const {
44 return create_file_count_ == 0 &&
45 create_file_from_count_ == 0 &&
46 remove_file_count_ == 0 &&
47 modify_file_count_ == 0 &&
48 create_directory_count_ == 0 &&
49 remove_directory_count_ == 0;
50 }
51
52 int create_file_count() const { return create_file_count_; }
53 int create_file_from_count() const { return create_file_from_count_; }
54 int remove_file_count() const { return remove_file_count_; }
55 int modify_file_count() const { return modify_file_count_; }
56 int create_directory_count() const { return create_directory_count_; }
57 int remove_directory_count() const { return remove_directory_count_; }
58
59 int get_and_reset_create_file_count() {
60 int tmp = create_file_count_;
61 create_file_count_ = 0;
62 return tmp;
63 }
64 int get_and_reset_create_file_from_count() {
65 int tmp = create_file_from_count_;
66 create_file_from_count_ = 0;
67 return tmp;
68 }
69 int get_and_reset_remove_file_count() {
70 int tmp = remove_file_count_;
71 remove_file_count_ = 0;
72 return tmp;
73 }
74 int get_and_reset_modify_file_count() {
75 int tmp = modify_file_count_;
76 modify_file_count_ = 0;
77 return tmp;
78 }
79 int get_and_reset_create_directory_count() {
80 int tmp = create_directory_count_;
81 create_directory_count_ = 0;
82 return tmp;
83 }
84 int get_and_reset_remove_directory_count() {
85 int tmp = remove_directory_count_;
86 remove_directory_count_ = 0;
87 return tmp;
88 }
89
90 private:
91 int create_file_count_;
92 int create_file_from_count_;
93 int remove_file_count_;
94 int modify_file_count_;
95 int create_directory_count_;
96 int remove_directory_count_;
97
98 DISALLOW_COPY_AND_ASSIGN(MockFileChangeObserver);
99 };
100
101 } // namespace fileapi
102
103 #endif // WEBKIT_FILEAPI_MOCK_FILE_CHANGE_OBSERVER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/local_file_system_operation_write_unittest.cc ('k') | webkit/fileapi/mock_file_change_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698