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

Side by Side Diff: device/vibration/vibration_manager_impl_default.cc

Issue 2774783003: [DeviceService] Add service tests for VibrationManager. (Closed)
Patch Set: Address comments from blundell@ Created 3 years, 8 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 | « device/vibration/vibration_manager_impl.h ('k') | services/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "device/vibration/vibration_manager_impl.h" 9 #include "device/vibration/vibration_manager_impl.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h" 10 #include "mojo/public/cpp/bindings/strong_binding.h"
11 11
12 namespace device { 12 namespace device {
13 13
14 int64_t VibrationManagerImpl::milli_seconds_for_testing_ = -1;
15 bool VibrationManagerImpl::cancelled_for_testing_ = false;
16
14 namespace { 17 namespace {
15 18
16 class VibrationManagerEmptyImpl : public mojom::VibrationManager { 19 class VibrationManagerEmptyImpl : public mojom::VibrationManager {
17 public: 20 public:
18 VibrationManagerEmptyImpl() {} 21 VibrationManagerEmptyImpl() {}
19 ~VibrationManagerEmptyImpl() override {} 22 ~VibrationManagerEmptyImpl() override {}
20 23
21 void Vibrate(int64_t milliseconds, const VibrateCallback& callback) override { 24 void Vibrate(int64_t milliseconds, const VibrateCallback& callback) override {
25 VibrationManagerImpl::milli_seconds_for_testing_ = milliseconds;
22 callback.Run(); 26 callback.Run();
23 } 27 }
24 28
25 void Cancel(const CancelCallback& callback) override { callback.Run(); } 29 void Cancel(const CancelCallback& callback) override {
30 VibrationManagerImpl::cancelled_for_testing_ = true;
31 callback.Run();
32 }
26 }; 33 };
27 34
28 } // namespace 35 } // namespace
29 36
30 // static 37 // static
31 void VibrationManagerImpl::Create(mojom::VibrationManagerRequest request) { 38 void VibrationManagerImpl::Create(mojom::VibrationManagerRequest request) {
32 mojo::MakeStrongBinding(base::MakeUnique<VibrationManagerEmptyImpl>(), 39 mojo::MakeStrongBinding(base::MakeUnique<VibrationManagerEmptyImpl>(),
33 std::move(request)); 40 std::move(request));
34 } 41 }
35 42
36 } // namespace device 43 } // namespace device
OLDNEW
« no previous file with comments | « device/vibration/vibration_manager_impl.h ('k') | services/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698