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 #include "content/browser/fileapi/mock_file_update_observer.h" | |
6 #include "testing/gtest/include/gtest/gtest.h" | |
7 | |
8 namespace storage { | |
9 | |
10 MockFileUpdateObserver::MockFileUpdateObserver() {} | |
tzik
2014/09/19 03:44:00
|is_ready_| needs to be initialized here.
iseki
2014/09/19 04:55:29
Done.
| |
11 | |
12 MockFileUpdateObserver::~MockFileUpdateObserver() {} | |
13 | |
14 // static | |
15 UpdateObserverList MockFileUpdateObserver::CreateList( | |
16 MockFileUpdateObserver* observer) { | |
17 UpdateObserverList list; | |
18 return list.AddObserver(observer, base::MessageLoopProxy::current().get()); | |
tzik
2014/09/19 03:44:00
Since MessageLoopProxy is moderately deprecated, c
iseki
2014/09/19 04:55:29
Done.
| |
19 } | |
20 | |
21 void MockFileUpdateObserver::OnStartUpdate(const FileSystemURL& url) { | |
22 if (is_ready_) | |
23 ++start_update_count_[url.path().value()]; | |
24 } | |
25 | |
26 void MockFileUpdateObserver::OnUpdate(const FileSystemURL& url, int64 delta) { | |
27 if (!is_ready_) | |
28 return; | |
29 int start = start_update_count_[url.path().value()]; | |
30 int end = end_update_count_[url.path().value()]; | |
31 EXPECT_LT(0, start - end); | |
32 } | |
33 | |
34 void MockFileUpdateObserver::OnEndUpdate(const FileSystemURL& url) { | |
35 if (is_ready_) | |
36 ++end_update_count_[url.path().value()]; | |
37 } | |
38 | |
39 } // namespace storage | |
OLD | NEW |