Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp

Issue 1845323002: Remove WebUnitTestSupport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/LocalDOMWindow.h" 10 #include "core/frame/LocalDOMWindow.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 #include "platform/testing/URLTestHelpers.h" 12 #include "platform/testing/URLTestHelpers.h"
13 #include "public/platform/Platform.h" 13 #include "public/platform/Platform.h"
14 #include "public/platform/WebPageVisibilityState.h" 14 #include "public/platform/WebPageVisibilityState.h"
15 #include "public/platform/WebUnitTestSupport.h" 15 #include "public/platform/WebURLLoaderMockFactory.h"
16 #include "public/platform/modules/wake_lock/WebWakeLockClient.h" 16 #include "public/platform/modules/wake_lock/WebWakeLockClient.h"
17 #include "public/web/WebCache.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "web/WebLocalFrameImpl.h" 19 #include "web/WebLocalFrameImpl.h"
19 #include "web/tests/FrameTestHelpers.h" 20 #include "web/tests/FrameTestHelpers.h"
20 21
21 namespace { 22 namespace {
22 23
23 using blink::ScreenWakeLock; 24 using blink::ScreenWakeLock;
24 using blink::WebWakeLockClient; 25 using blink::WebWakeLockClient;
25 26
26 class TestWebWakeLockClient: public WebWakeLockClient { 27 class TestWebWakeLockClient: public WebWakeLockClient {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 { 61 {
61 m_webViewHelper.initialize(true, &m_testWebFrameClient); 62 m_webViewHelper.initialize(true, &m_testWebFrameClient);
62 blink::URLTestHelpers::registerMockedURLFromBaseURL( 63 blink::URLTestHelpers::registerMockedURLFromBaseURL(
63 blink::WebString::fromUTF8("http://example.com/"), 64 blink::WebString::fromUTF8("http://example.com/"),
64 blink::WebString::fromUTF8("foo.html")); 65 blink::WebString::fromUTF8("foo.html"));
65 loadFrame(); 66 loadFrame();
66 } 67 }
67 68
68 void TearDown() override 69 void TearDown() override
69 { 70 {
70 blink::Platform::current()->unitTestSupport()->unregisterAllMockedURLs() ; 71 blink::Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs ();
72 blink::WebCache::clear();
71 } 73 }
72 74
73 void loadFrame() 75 void loadFrame()
74 { 76 {
75 blink::FrameTestHelpers::loadFrame( 77 blink::FrameTestHelpers::loadFrame(
76 m_webViewHelper.webView()->mainFrame(), 78 m_webViewHelper.webView()->mainFrame(),
77 "http://example.com/foo.html"); 79 "http://example.com/foo.html");
78 m_webViewHelper.webViewImpl()->updateAllLifecyclePhases(); 80 m_webViewHelper.webViewImpl()->updateAllLifecyclePhases();
79 } 81 }
80 82
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 ASSERT_FALSE(clientKeepScreenAwake()); 188 ASSERT_FALSE(clientKeepScreenAwake());
187 189
188 setKeepAwake(true); 190 setKeepAwake(true);
189 loadFrame(); 191 loadFrame();
190 192
191 EXPECT_FALSE(screenKeepAwake()); 193 EXPECT_FALSE(screenKeepAwake());
192 EXPECT_FALSE(clientKeepScreenAwake()); 194 EXPECT_FALSE(clientKeepScreenAwake());
193 } 195 }
194 196
195 } // namespace 197 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698