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 #include "base/thread_task_runner_handle.h"
6 #include "content/browser/fileapi/mock_file_update_observer.h"
7 #include "testing/gtest/include/gtest/gtest.h"
11 MockFileUpdateObserver::MockFileUpdateObserver() : is_ready_(false) {
14 MockFileUpdateObserver::~MockFileUpdateObserver() {
18 UpdateObserverList
MockFileUpdateObserver::CreateList(
19 MockFileUpdateObserver
* observer
) {
20 UpdateObserverList list
;
21 return list
.AddObserver(observer
, base::ThreadTaskRunnerHandle::Get().get());
24 void MockFileUpdateObserver::OnStartUpdate(const FileSystemURL
& url
) {
26 ++start_update_count_
[url
];
29 void MockFileUpdateObserver::OnUpdate(const FileSystemURL
& url
, int64 delta
) {
32 int start
= start_update_count_
[url
];
33 int end
= end_update_count_
[url
];
34 EXPECT_LT(0, start
- end
);
37 void MockFileUpdateObserver::OnEndUpdate(const FileSystemURL
& url
) {
39 ++end_update_count_
[url
];
42 } // namespace storage