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() { |