OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
7 #include "content/browser/wake_lock/wake_lock_service_context.h" | |
8 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
10 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
11 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 11 #include "content/public/test/content_browser_test_utils.h" |
13 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
14 #include "content/shell/browser/shell.h" | 13 #include "content/shell/browser/shell.h" |
15 #include "content/test/content_browser_test_utils_internal.h" | 14 #include "content/test/content_browser_test_utils_internal.h" |
| 15 #include "device/wake_lock/wake_lock_service_context.h" |
16 #include "net/dns/mock_host_resolver.h" | 16 #include "net/dns/mock_host_resolver.h" |
17 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const char kBlinkWakeLockFeature[] = "WakeLock"; | 23 const char kBlinkWakeLockFeature[] = "WakeLock"; |
24 | 24 |
25 } // namespace | 25 } // namespace |
(...skipping 29 matching lines...) Expand all Loading... |
55 FrameTreeNode* GetNestedFrameNode() { | 55 FrameTreeNode* GetNestedFrameNode() { |
56 FrameTreeNode* root = GetWebContentsImpl()->GetFrameTree()->root(); | 56 FrameTreeNode* root = GetWebContentsImpl()->GetFrameTree()->root(); |
57 CHECK_EQ(1U, root->child_count()); | 57 CHECK_EQ(1U, root->child_count()); |
58 return root->child_at(0); | 58 return root->child_at(0); |
59 } | 59 } |
60 | 60 |
61 RenderFrameHost* GetNestedFrame() { | 61 RenderFrameHost* GetNestedFrame() { |
62 return GetNestedFrameNode()->current_frame_host(); | 62 return GetNestedFrameNode()->current_frame_host(); |
63 } | 63 } |
64 | 64 |
65 WakeLockServiceContext* GetWakeLockServiceContext() { | 65 device::WakeLockServiceContext* GetWakeLockServiceContext() { |
66 return GetWebContentsImpl()->GetWakeLockServiceContext(); | 66 return GetWebContentsImpl()->GetWakeLockServiceContext(); |
67 } | 67 } |
68 | 68 |
69 bool HasWakeLock() { | 69 bool HasWakeLock() { |
70 return GetWakeLockServiceContext()->HasWakeLockForTests(); | 70 return GetWakeLockServiceContext()->HasWakeLockForTests(); |
71 } | 71 } |
72 | 72 |
73 void WaitForPossibleUpdate() { | 73 void WaitForPossibleUpdate() { |
74 // As Mojo channels have no common FIFO order in respect to each other and | 74 // As Mojo channels have no common FIFO order in respect to each other and |
75 // to the Chromium IPC, we cannot assume that when screen.keepAwake state | 75 // to the Chromium IPC, we cannot assume that when screen.keepAwake state |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 GetNestedFrame()->GetProcess(), | 367 GetNestedFrame()->GetProcess(), |
368 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 368 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
369 GetNestedFrame()->GetProcess()->Shutdown(0, false); | 369 GetNestedFrame()->GetProcess()->Shutdown(0, false); |
370 watcher.Wait(); | 370 watcher.Wait(); |
371 | 371 |
372 // Screen wake lock should be released. | 372 // Screen wake lock should be released. |
373 EXPECT_FALSE(HasWakeLock()); | 373 EXPECT_FALSE(HasWakeLock()); |
374 } | 374 } |
375 | 375 |
376 } // namespace content | 376 } // namespace content |
OLD | NEW |