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.
5 #ifndef CONTENT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_
6 #define CONTENT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_
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"
18 // Mock file change observer.
19 class MockFileUpdateObserver
: public FileUpdateObserver
{
21 MockFileUpdateObserver();
22 ~MockFileUpdateObserver() override
;
24 // Creates a ChangeObserverList which only contains given |observer|.
25 static UpdateObserverList
CreateList(MockFileUpdateObserver
* observer
);
27 // FileUpdateObserver overrides.
28 void OnStartUpdate(const FileSystemURL
& url
) override
;
29 void OnUpdate(const FileSystemURL
& url
, int64 delta
) override
;
30 void OnEndUpdate(const FileSystemURL
& url
) override
;
32 void Enable() { is_ready_
= true; }
35 start_update_count_
.clear();
36 end_update_count_
.clear();
41 std::map
<FileSystemURL
, int, FileSystemURL::Comparator
> start_update_count_
;
42 std::map
<FileSystemURL
, int, FileSystemURL::Comparator
> end_update_count_
;
45 DISALLOW_COPY_AND_ASSIGN(MockFileUpdateObserver
);
48 } // namespace storage
50 #endif // CONTENT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_