| 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/InterfaceProvider.h" | 14 #include "public/platform/InterfaceProvider.h" |
| 15 #include "public/platform/Platform.h" | 15 #include "public/platform/Platform.h" |
| 16 #include "public/platform/WebCache.h" | |
| 17 #include "public/platform/WebPageVisibilityState.h" | 16 #include "public/platform/WebPageVisibilityState.h" |
| 18 #include "public/platform/WebURLLoaderMockFactory.h" | 17 #include "public/platform/WebURLLoaderMockFactory.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "web/WebLocalFrameImpl.h" | 19 #include "web/WebLocalFrameImpl.h" |
| 21 #include "web/tests/FrameTestHelpers.h" | 20 #include "web/tests/FrameTestHelpers.h" |
| 22 | 21 |
| 23 #include <memory> | 22 #include <memory> |
| 24 | 23 |
| 25 namespace { | 24 namespace { |
| 26 | 25 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void SetUp() override { | 83 void SetUp() override { |
| 85 m_webViewHelper.initialize(true, &m_testWebFrameClient); | 84 m_webViewHelper.initialize(true, &m_testWebFrameClient); |
| 86 blink::URLTestHelpers::registerMockedURLLoadFromBase( | 85 blink::URLTestHelpers::registerMockedURLLoadFromBase( |
| 87 blink::WebString::fromUTF8("http://example.com/"), | 86 blink::WebString::fromUTF8("http://example.com/"), |
| 88 blink::testing::webTestDataPath(), | 87 blink::testing::webTestDataPath(), |
| 89 blink::WebString::fromUTF8("foo.html")); | 88 blink::WebString::fromUTF8("foo.html")); |
| 90 loadFrame(); | 89 loadFrame(); |
| 91 } | 90 } |
| 92 | 91 |
| 93 void TearDown() override { | 92 void TearDown() override { |
| 94 blink::Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 93 blink::Platform::current() |
| 95 blink::WebCache::clear(); | 94 ->getURLLoaderMockFactory() |
| 95 ->unregisterAllURLsAndClearMemoryCache(); |
| 96 blink::testing::runPendingTasks(); | 96 blink::testing::runPendingTasks(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void loadFrame() { | 99 void loadFrame() { |
| 100 blink::FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), | 100 blink::FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), |
| 101 "http://example.com/foo.html"); | 101 "http://example.com/foo.html"); |
| 102 m_webViewHelper.webView()->updateAllLifecyclePhases(); | 102 m_webViewHelper.webView()->updateAllLifecyclePhases(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 blink::LocalFrame* frame() { | 105 blink::LocalFrame* frame() { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 ASSERT_FALSE(clientKeepScreenAwake()); | 206 ASSERT_FALSE(clientKeepScreenAwake()); |
| 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 |
| OLD | NEW |