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

Unified Diff: device/wake_lock/fake_wake_lock_service_impl.h

Issue 2883903002: Add service unittest for WakeLockServiceImpl. (Closed)
Patch Set: Add FakeWakeLockServiceImpl. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: device/wake_lock/fake_wake_lock_service_impl.h
diff --git a/device/wake_lock/fake_wake_lock_service_impl.h b/device/wake_lock/fake_wake_lock_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..197b34b4670dc3eb5e4ee41ce9a44b8fc3e2cfee
--- /dev/null
+++ b/device/wake_lock/fake_wake_lock_service_impl.h
@@ -0,0 +1,48 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_WAKE_LOCK_FAKE_WAKE_LOCK_SERVICE_IMPL_H_
+#define DEVICE_WAKE_LOCK_FAKE_WAKE_LOCK_SERVICE_IMPL_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
+#include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h"
+#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
+#include "device/wake_lock/wake_lock_service_impl.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace device {
+
+class FakeWakeLockServiceImpl : public WakeLockServiceImpl {
blundell 2017/05/29 13:17:08 nit: I'd prefer having WakeLockServiceImpl create
ke.he 2017/05/31 11:38:15 Colin, Sorry I'm not sure If I understanding you c
+ public:
+ FakeWakeLockServiceImpl(
+ mojom::WakeLockServiceRequest request,
+ mojom::WakeLockType type,
+ mojom::WakeLockReason reason,
+ const std::string& description,
+ int context_id,
+ WakeLockContextCallback native_view_getter,
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
+ ~FakeWakeLockServiceImpl() override;
+
+ void HasWakeLockForTests(
+ const HasWakeLockForTestsCallback& callback) override;
+
+ private:
+ void UpdateWakeLock() override;
+ void CreateWakeLock() override;
+ void RemoveWakeLock() override;
+
+ bool has_fake_wake_lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeWakeLockServiceImpl);
+};
+
+} // namespace device
+
+#endif // DEVICE_WAKE_LOCK_FAKE_WAKE_LOCK_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698