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

Side by Side Diff: content/browser/fileapi/mock_file_update_observer.cc

Issue 579153002: Add update observer to file_system_operation_impl_unittest for (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « content/browser/fileapi/mock_file_update_observer.h ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "base/thread_task_runner_handle.h"
6 #include "content/browser/fileapi/mock_file_update_observer.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace storage {
10
11 MockFileUpdateObserver::MockFileUpdateObserver() : is_ready_(false) {
12 }
13
14 MockFileUpdateObserver::~MockFileUpdateObserver() {
15 }
16
17 // static
18 UpdateObserverList MockFileUpdateObserver::CreateList(
19 MockFileUpdateObserver* observer) {
20 UpdateObserverList list;
21 return list.AddObserver(observer, base::ThreadTaskRunnerHandle::Get().get());
22 }
23
24 void MockFileUpdateObserver::OnStartUpdate(const FileSystemURL& url) {
25 if (is_ready_)
26 ++start_update_count_[url];
27 }
28
29 void MockFileUpdateObserver::OnUpdate(const FileSystemURL& url, int64 delta) {
30 if (!is_ready_)
31 return;
32 int start = start_update_count_[url];
33 int end = end_update_count_[url];
34 EXPECT_LT(0, start - end);
35 }
36
37 void MockFileUpdateObserver::OnEndUpdate(const FileSystemURL& url) {
38 if (is_ready_)
39 ++end_update_count_[url];
40 }
41
42 } // namespace storage
OLDNEW
« no previous file with comments | « content/browser/fileapi/mock_file_update_observer.h ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698