OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/thread_task_runner_handle.h" | 5 #include "base/thread_task_runner_handle.h" |
6 #include "content/browser/fileapi/mock_file_update_observer.h" | 6 #include "content/browser/fileapi/mock_file_update_observer.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace storage { | 9 namespace storage { |
10 | 10 |
11 MockFileUpdateObserver::MockFileUpdateObserver() : is_ready_(false) { | 11 MockFileUpdateObserver::MockFileUpdateObserver() : is_ready_(false) { |
12 } | 12 } |
13 | 13 |
14 MockFileUpdateObserver::~MockFileUpdateObserver() { | 14 MockFileUpdateObserver::~MockFileUpdateObserver() { |
15 } | 15 } |
16 | 16 |
17 // static | 17 // static |
18 UpdateObserverList MockFileUpdateObserver::CreateList( | 18 UpdateObserverList MockFileUpdateObserver::CreateList( |
19 MockFileUpdateObserver* observer) { | 19 MockFileUpdateObserver* observer) { |
20 UpdateObserverList list; | 20 UpdateObserverList list; |
21 return list.AddObserver(observer, base::ThreadTaskRunnerHandle::Get().get()); | 21 return list.AddObserver(observer, base::ThreadTaskRunnerHandle::Get().get()); |
22 } | 22 } |
23 | 23 |
24 void MockFileUpdateObserver::OnStartUpdate(const FileSystemURL& url) { | 24 void MockFileUpdateObserver::OnStartUpdate(const FileSystemURL& url) { |
25 if (is_ready_) | 25 if (is_ready_) |
26 ++start_update_count_[url]; | 26 ++start_update_count_[url]; |
27 } | 27 } |
28 | 28 |
29 void MockFileUpdateObserver::OnUpdate(const FileSystemURL& url, int64 delta) { | 29 void MockFileUpdateObserver::OnUpdate(const FileSystemURL& url, int64_t delta) { |
30 if (!is_ready_) | 30 if (!is_ready_) |
31 return; | 31 return; |
32 int start = start_update_count_[url]; | 32 int start = start_update_count_[url]; |
33 int end = end_update_count_[url]; | 33 int end = end_update_count_[url]; |
34 EXPECT_LT(0, start - end); | 34 EXPECT_LT(0, start - end); |
35 } | 35 } |
36 | 36 |
37 void MockFileUpdateObserver::OnEndUpdate(const FileSystemURL& url) { | 37 void MockFileUpdateObserver::OnEndUpdate(const FileSystemURL& url) { |
38 if (is_ready_) | 38 if (is_ready_) |
39 ++end_update_count_[url]; | 39 ++end_update_count_[url]; |
40 } | 40 } |
41 | 41 |
42 } // namespace storage | 42 } // namespace storage |
OLD | NEW |