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 "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
11 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
12 #include "platform/testing/URLTestHelpers.h" | 12 #include "platform/testing/URLTestHelpers.h" |
13 #include "platform/testing/UnitTestHelpers.h" | 13 #include "platform/testing/UnitTestHelpers.h" |
14 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
15 #include "public/platform/ServiceRegistry.h" | 15 #include "public/platform/ServiceRegistry.h" |
16 #include "public/platform/WebPageVisibilityState.h" | 16 #include "public/platform/WebPageVisibilityState.h" |
17 #include "public/platform/WebURLLoaderMockFactory.h" | 17 #include "public/platform/WebURLLoaderMockFactory.h" |
18 #include "public/web/WebCache.h" | 18 #include "public/web/WebCache.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "web/WebLocalFrameImpl.h" | 20 #include "web/WebLocalFrameImpl.h" |
21 #include "web/tests/FrameTestHelpers.h" | 21 #include "web/tests/FrameTestHelpers.h" |
22 | 22 |
23 #include <memory> | 23 #include <memory> |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 using blink::ScreenWakeLock; | 27 using blink::ScreenWakeLock; |
28 using blink::mojom::wtf::WakeLockService; | 28 using blink::mojom::blink::WakeLockService; |
29 using blink::mojom::wtf::WakeLockServiceRequest; | 29 using blink::mojom::blink::WakeLockServiceRequest; |
30 | 30 |
31 // This class allows connecting service requests to a MockWakeLockService. | 31 // This class allows connecting service requests to a MockWakeLockService. |
32 class MockServiceRegistry : public blink::ServiceRegistry { | 32 class MockServiceRegistry : public blink::ServiceRegistry { |
33 public: | 33 public: |
34 MockServiceRegistry() : m_wakeLockStatus(false) {} | 34 MockServiceRegistry() : m_wakeLockStatus(false) {} |
35 ~MockServiceRegistry() {} | 35 ~MockServiceRegistry() {} |
36 | 36 |
37 void connectToRemoteService(const char* name, mojo::ScopedMessagePipeHandle)
override; | 37 void connectToRemoteService(const char* name, mojo::ScopedMessagePipeHandle)
override; |
38 | 38 |
39 bool wakeLockStatus() const { return m_wakeLockStatus; } | 39 bool wakeLockStatus() const { return m_wakeLockStatus; } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 ASSERT_FALSE(clientKeepScreenAwake()); | 217 ASSERT_FALSE(clientKeepScreenAwake()); |
218 | 218 |
219 setKeepAwake(true); | 219 setKeepAwake(true); |
220 loadFrame(); | 220 loadFrame(); |
221 | 221 |
222 EXPECT_FALSE(screenKeepAwake()); | 222 EXPECT_FALSE(screenKeepAwake()); |
223 EXPECT_FALSE(clientKeepScreenAwake()); | 223 EXPECT_FALSE(clientKeepScreenAwake()); |
224 } | 224 } |
225 | 225 |
226 } // namespace | 226 } // namespace |
OLD | NEW |