Chromium Code Reviews| 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..c6754cab8e7157e9a8190ec3eeb8d05a9af544e1 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,19 @@ 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; |
| + base::Closure quit_closure = run_loop.QuitClosure(); |
|
dcheng
2017/03/17 06:55:25
Nit: this appears unused.
blundell
2017/03/17 12:28:21
Done.
|
| + |
| + GetWakeLockServiceContext()->HasWakeLockForTests( |
| + base::Bind(&OnHasWakeLock, &has_wakelock)); |
| + run_loop.Run(); |
| + return has_wakelock; |
| } |
| void WaitForPossibleUpdate() { |