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 "modules/wake_lock/ScreenWakeLock.h" | 5 #include "modules/wake_lock/ScreenWakeLock.h" |
6 | 6 |
7 #include "core/dom/DOMImplementation.h" | 7 #include "core/dom/DOMImplementation.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/DocumentInit.h" | 9 #include "core/dom/DocumentInit.h" |
10 #include "core/frame/FrameTestHelpers.h" | 10 #include "core/frame/FrameTestHelpers.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 void LoadFrame() { | 99 void LoadFrame() { |
100 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), | 100 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), |
101 "http://example.com/foo.html"); | 101 "http://example.com/foo.html"); |
102 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); | 102 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); |
103 } | 103 } |
104 | 104 |
105 LocalFrame* GetFrame() { | 105 LocalFrame* GetFrame() { |
106 DCHECK(web_view_helper_.WebView()); | 106 DCHECK(web_view_helper_.WebView()); |
107 DCHECK(web_view_helper_.WebView()->MainFrameImpl()); | 107 DCHECK(web_view_helper_.LocalMainFrame()); |
108 return web_view_helper_.WebView()->MainFrameImpl()->GetFrame(); | 108 return web_view_helper_.LocalMainFrame()->GetFrame(); |
109 } | 109 } |
110 | 110 |
111 Screen* GetScreen() { | 111 Screen* GetScreen() { |
112 DCHECK(GetFrame()); | 112 DCHECK(GetFrame()); |
113 DCHECK(GetFrame()->DomWindow()); | 113 DCHECK(GetFrame()->DomWindow()); |
114 return GetFrame()->DomWindow()->screen(); | 114 return GetFrame()->DomWindow()->screen(); |
115 } | 115 } |
116 | 116 |
117 bool ScreenKeepAwake() { | 117 bool ScreenKeepAwake() { |
118 DCHECK(GetScreen()); | 118 DCHECK(GetScreen()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 SetKeepAwake(true); | 208 SetKeepAwake(true); |
209 LoadFrame(); | 209 LoadFrame(); |
210 | 210 |
211 EXPECT_FALSE(ScreenKeepAwake()); | 211 EXPECT_FALSE(ScreenKeepAwake()); |
212 EXPECT_FALSE(ClientKeepScreenAwake()); | 212 EXPECT_FALSE(ClientKeepScreenAwake()); |
213 } | 213 } |
214 | 214 |
215 } // namespace | 215 } // namespace |
216 } // namespace blink | 216 } // namespace blink |
OLD | NEW |