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

Unified Diff: content/browser/wake_lock/wake_lock_browsertest.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
Index: content/browser/wake_lock/wake_lock_browsertest.cc
diff --git a/content/browser/wake_lock/wake_lock_browsertest.cc b/content/browser/wake_lock/wake_lock_browsertest.cc
index c86ad7bc5f9056e80dd132b243241bcfb3b0bb4c..fee42cae21434af11aaede46037137fbbb8be327 100644
--- a/content/browser/wake_lock/wake_lock_browsertest.cc
+++ b/content/browser/wake_lock/wake_lock_browsertest.cc
@@ -12,7 +12,6 @@
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
-#include "device/wake_lock/wake_lock_service_context.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
@@ -22,6 +21,11 @@ namespace {
const char kBlinkWakeLockFeature[] = "WakeLock";
+void OnHasWakeLock(bool* out, bool has_wakelock) {
+ *out = has_wakelock;
+ base::MessageLoop::current()->QuitNow();
+}
+
} // namespace
class WakeLockTest : public ContentBrowserTest {
@@ -62,12 +66,18 @@ class WakeLockTest : public ContentBrowserTest {
return GetNestedFrameNode()->current_frame_host();
}
- device::WakeLockServiceContext* GetWakeLockServiceContext() {
+ device::mojom::WakeLockContext* GetWakeLockServiceContext() {
return GetWebContentsImpl()->GetWakeLockServiceContext();
}
bool HasWakeLock() {
- return GetWakeLockServiceContext()->HasWakeLockForTests();
+ bool has_wakelock = false;
+ base::RunLoop run_loop;
+
+ GetWakeLockServiceContext()->HasWakeLockForTests(
+ base::Bind(&OnHasWakeLock, &has_wakelock));
+ run_loop.Run();
+ return has_wakelock;
}
void WaitForPossibleUpdate() {
« no previous file with comments | « content/browser/service_manager/service_manager_context.cc ('k') | content/browser/wake_lock/wake_lock_context_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698