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

Unified Diff: device/wake_lock/wake_lock_service_impl_for_testing.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/wake_lock/wake_lock_service_impl.cc ('k') | device/wake_lock/wake_lock_service_impl_for_testing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/wake_lock/wake_lock_service_impl_for_testing.h
diff --git a/device/wake_lock/wake_lock_service_impl_for_testing.h b/device/wake_lock/wake_lock_service_impl_for_testing.h
new file mode 100644
index 0000000000000000000000000000000000000000..23409d3593a2c9307497f3d95350405f27029e3d
--- /dev/null
+++ b/device/wake_lock/wake_lock_service_impl_for_testing.h
@@ -0,0 +1,47 @@
+// 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 SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_
+#define SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_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 WakeLockServiceImplForTesting : public WakeLockServiceImpl {
+ public:
+ WakeLockServiceImplForTesting(
+ 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);
+ ~WakeLockServiceImplForTesting() override;
+
+ void HasWakeLockForTests(HasWakeLockForTestsCallback callback) override;
+
+ private:
+ void UpdateWakeLock() override;
+ void CreateWakeLock() override;
+ void RemoveWakeLock() override;
+
+ bool has_wake_lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(WakeLockServiceImplForTesting);
+};
+
+} // namespace device
+
+#endif // SERVICES_DEVICE_WAKE_LOCK_WAKE_LOCK_SERVICE_IMPL_FOR_TESTING_H_
« no previous file with comments | « device/wake_lock/wake_lock_service_impl.cc ('k') | device/wake_lock/wake_lock_service_impl_for_testing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698