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

Unified Diff: device/wake_lock/wake_lock_service_context_unittest.cc

Issue 2734943003: Device Service: Decouple Wake Lock from //content (Closed)
Patch Set: Rebase Created 3 years, 9 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_context.cc ('k') | device/wake_lock/wake_lock_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/wake_lock/wake_lock_service_context_unittest.cc
diff --git a/device/wake_lock/wake_lock_service_context_unittest.cc b/device/wake_lock/wake_lock_service_context_unittest.cc
deleted file mode 100644
index 8b7f6d14ceb4b242b9e104e2e95aa361d4fd3e4c..0000000000000000000000000000000000000000
--- a/device/wake_lock/wake_lock_service_context_unittest.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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.
-
-#include "device/wake_lock/wake_lock_service_context.h"
-
-#include <memory>
-
-#include "base/message_loop/message_loop.h"
-#include "base/process/kill.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace device {
-
-class WakeLockServiceContextTest : public testing::Test {
- public:
- WakeLockServiceContextTest()
- : wake_lock_service_context_(
- base::ThreadTaskRunnerHandle::Get(),
- base::Bind(&WakeLockServiceContextTest::GetNativeView,
- base::Unretained(this))) {}
-
- protected:
- void RequestWakeLock() { GetWakeLockServiceContext()->RequestWakeLock(); }
-
- void CancelWakeLock() { GetWakeLockServiceContext()->CancelWakeLock(); }
-
- WakeLockServiceContext* GetWakeLockServiceContext() {
- return &wake_lock_service_context_;
- }
-
- bool HasWakeLock() {
- return GetWakeLockServiceContext()->HasWakeLockForTests();
- }
-
- private:
- gfx::NativeView GetNativeView() { return nullptr; }
-
- base::MessageLoop message_loop_;
- WakeLockServiceContext wake_lock_service_context_;
-};
-
-TEST_F(WakeLockServiceContextTest, NoLockInitially) {
- EXPECT_FALSE(HasWakeLock());
-}
-
-TEST_F(WakeLockServiceContextTest, LockUnlock) {
- ASSERT_TRUE(GetWakeLockServiceContext());
-
- // Request wake lock.
- RequestWakeLock();
-
- // Should set the blocker.
- EXPECT_TRUE(HasWakeLock());
-
- // Remove wake lock request.
- CancelWakeLock();
-
- // Should remove the blocker.
- EXPECT_FALSE(HasWakeLock());
-}
-
-} // namespace device
« no previous file with comments | « device/wake_lock/wake_lock_service_context.cc ('k') | device/wake_lock/wake_lock_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698