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

Side by Side Diff: device/wake_lock/wake_lock_service_impl.cc

Issue 2883903002: Add service unittest for WakeLockServiceImpl. (Closed)
Patch Set: Rename Fake* to *ForTesting Created 3 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "device/wake_lock/wake_lock_service_impl.h" 5 #include "device/wake_lock/wake_lock_service_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } // namespace 46 } // namespace
47 47
48 WakeLockServiceImpl::WakeLockServiceImpl( 48 WakeLockServiceImpl::WakeLockServiceImpl(
49 mojom::WakeLockServiceRequest request, 49 mojom::WakeLockServiceRequest request,
50 mojom::WakeLockType type, 50 mojom::WakeLockType type,
51 mojom::WakeLockReason reason, 51 mojom::WakeLockReason reason,
52 const std::string& description, 52 const std::string& description,
53 int context_id, 53 int context_id,
54 WakeLockContextCallback native_view_getter, 54 WakeLockContextCallback native_view_getter,
55 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) 55 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
56 : type_(type), 56 : num_lock_requests_(0),
57 type_(type),
57 reason_(reason), 58 reason_(reason),
58 description_(base::MakeUnique<std::string>(description)), 59 description_(base::MakeUnique<std::string>(description)),
59 num_lock_requests_(0),
60 #if defined(OS_ANDROID) 60 #if defined(OS_ANDROID)
61 context_id_(context_id), 61 context_id_(context_id),
62 native_view_getter_(native_view_getter), 62 native_view_getter_(native_view_getter),
63 #endif 63 #endif
64 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), 64 main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
65 file_task_runner_(std::move(file_task_runner)) { 65 file_task_runner_(std::move(file_task_runner)) {
66 AddClient(std::move(request)); 66 AddClient(std::move(request));
67 binding_set_.set_connection_error_handler(base::Bind( 67 binding_set_.set_connection_error_handler(base::Bind(
68 &WakeLockServiceImpl::OnConnectionError, base::Unretained(this))); 68 &WakeLockServiceImpl::OnConnectionError, base::Unretained(this)));
69 } 69 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (*binding_set_.dispatch_context() && num_lock_requests_ > 0) { 156 if (*binding_set_.dispatch_context() && num_lock_requests_ > 0) {
157 num_lock_requests_--; 157 num_lock_requests_--;
158 UpdateWakeLock(); 158 UpdateWakeLock();
159 } 159 }
160 160
161 if (binding_set_.empty()) 161 if (binding_set_.empty())
162 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 162 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
163 } 163 }
164 164
165 } // namespace device 165 } // namespace device
OLDNEW
« no previous file with comments | « device/wake_lock/wake_lock_service_impl.h ('k') | device/wake_lock/wake_lock_service_impl_for_testing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698