| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_ | 5 #ifndef SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_FOR_TESTING_H_ |
| 6 #define SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_ | 6 #define SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_FOR_TESTING_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "device/wake_lock/public/interfaces/wake_lock.mojom.h" |
| 13 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" | 14 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" |
| 14 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" | 15 #include "device/wake_lock/wake_lock.h" |
| 15 #include "device/wake_lock/wake_lock_service_impl.h" | |
| 16 #include "mojo/public/cpp/bindings/binding_set.h" | 16 #include "mojo/public/cpp/bindings/binding_set.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 18 | 18 |
| 19 namespace device { | 19 namespace device { |
| 20 | 20 |
| 21 class WakeLockServiceImplForTesting : public WakeLockServiceImpl { | 21 class WakeLockForTesting : public WakeLock { |
| 22 public: | 22 public: |
| 23 WakeLockServiceImplForTesting( | 23 WakeLockForTesting( |
| 24 mojom::WakeLockServiceRequest request, | 24 mojom::WakeLockRequest request, |
| 25 mojom::WakeLockType type, | 25 mojom::WakeLockType type, |
| 26 mojom::WakeLockReason reason, | 26 mojom::WakeLockReason reason, |
| 27 const std::string& description, | 27 const std::string& description, |
| 28 int context_id, | 28 int context_id, |
| 29 WakeLockContextCallback native_view_getter, | 29 WakeLockContextCallback native_view_getter, |
| 30 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); | 30 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
| 31 ~WakeLockServiceImplForTesting() override; | 31 ~WakeLockForTesting() override; |
| 32 | 32 |
| 33 void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override; | 33 void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 void UpdateWakeLock() override; | 36 void UpdateWakeLock() override; |
| 37 void CreateWakeLock() override; | 37 void CreateWakeLock() override; |
| 38 void RemoveWakeLock() override; | 38 void RemoveWakeLock() override; |
| 39 | 39 |
| 40 bool has_wake_lock_; | 40 bool has_wake_lock_; |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImplForTesting); | 42 DISALLOW_COPY_AND_ASSIGN(WakeLockForTesting); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace device | 45 } // namespace device |
| 46 | 46 |
| 47 #endif // SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_ | 47 #endif // SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_FOR_TESTING_H_ |
| OLD | NEW |