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

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

Issue 2683033005: URLLoaderMockFactory: clear MemoryCache in unregisterAllURLs (Closed)
Patch Set: Created 3 years, 10 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 "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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()->getURLLoaderMockFactory()->unregisterAllURLs();
95 blink::WebCache::clear();
96 blink::testing::runPendingTasks(); 94 blink::testing::runPendingTasks();
97 } 95 }
98 96
99 void loadFrame() { 97 void loadFrame() {
100 blink::FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), 98 blink::FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(),
101 "http://example.com/foo.html"); 99 "http://example.com/foo.html");
102 m_webViewHelper.webView()->updateAllLifecyclePhases(); 100 m_webViewHelper.webView()->updateAllLifecyclePhases();
103 } 101 }
104 102
105 blink::LocalFrame* frame() { 103 blink::LocalFrame* frame() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 ASSERT_FALSE(clientKeepScreenAwake()); 204 ASSERT_FALSE(clientKeepScreenAwake());
207 205
208 setKeepAwake(true); 206 setKeepAwake(true);
209 loadFrame(); 207 loadFrame();
210 208
211 EXPECT_FALSE(screenKeepAwake()); 209 EXPECT_FALSE(screenKeepAwake());
212 EXPECT_FALSE(clientKeepScreenAwake()); 210 EXPECT_FALSE(clientKeepScreenAwake());
213 } 211 }
214 212
215 } // namespace 213 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698