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

Side by Side Diff: third_party/WebKit/Source/web/tests/PrerenderingTest.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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/dom/NodeTraversal.h" 31 #include "core/dom/NodeTraversal.h"
32 #include "platform/testing/URLTestHelpers.h" 32 #include "platform/testing/URLTestHelpers.h"
33 #include "public/platform/Platform.h" 33 #include "public/platform/Platform.h"
34 #include "public/platform/WebPrerender.h" 34 #include "public/platform/WebPrerender.h"
35 #include "public/platform/WebPrerenderingSupport.h" 35 #include "public/platform/WebPrerenderingSupport.h"
36 #include "public/platform/WebString.h" 36 #include "public/platform/WebString.h"
37 #include "public/platform/WebUnitTestSupport.h" 37 #include "public/platform/WebURLLoaderMockFactory.h"
38 #include "public/web/WebCache.h" 38 #include "public/web/WebCache.h"
39 #include "public/web/WebFrame.h" 39 #include "public/web/WebFrame.h"
40 #include "public/web/WebPrerendererClient.h" 40 #include "public/web/WebPrerendererClient.h"
41 #include "public/web/WebScriptSource.h" 41 #include "public/web/WebScriptSource.h"
42 #include "public/web/WebView.h" 42 #include "public/web/WebView.h"
43 #include "public/web/WebViewClient.h" 43 #include "public/web/WebViewClient.h"
44 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
45 #include "web/WebLocalFrameImpl.h" 45 #include "web/WebLocalFrameImpl.h"
46 #include "web/tests/FrameTestHelpers.h" 46 #include "web/tests/FrameTestHelpers.h"
47 #include "wtf/OwnPtr.h" 47 #include "wtf/OwnPtr.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 Vector<WebPrerender> m_addedPrerenders; 163 Vector<WebPrerender> m_addedPrerenders;
164 Vector<WebPrerender> m_canceledPrerenders; 164 Vector<WebPrerender> m_canceledPrerenders;
165 Vector<WebPrerender> m_abandonedPrerenders; 165 Vector<WebPrerender> m_abandonedPrerenders;
166 }; 166 };
167 167
168 class PrerenderingTest : public testing::Test { 168 class PrerenderingTest : public testing::Test {
169 public: 169 public:
170 ~PrerenderingTest() override 170 ~PrerenderingTest() override
171 { 171 {
172 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 172 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
173 WebCache::clear();
173 } 174 }
174 175
175 void initialize(const char* baseURL, const char* fileName) 176 void initialize(const char* baseURL, const char* fileName)
176 { 177 {
177 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL ), WebString::fromUTF8(fileName)); 178 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL ), WebString::fromUTF8(fileName));
178 const bool RunJavascript = true; 179 const bool RunJavascript = true;
179 m_webViewHelper.initialize(RunJavascript); 180 m_webViewHelper.initialize(RunJavascript);
180 m_webViewHelper.webView()->setPrerendererClient(&m_prerendererClient); 181 m_webViewHelper.webView()->setPrerendererClient(&m_prerendererClient);
181 182
182 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), std: :string(baseURL) + fileName); 183 FrameTestHelpers::loadFrame(m_webViewHelper.webView()->mainFrame(), std: :string(baseURL) + fileName);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 WebPrerender relNextOnly = prerendererClient()->releaseWebPrerender(); 489 WebPrerender relNextOnly = prerendererClient()->releaseWebPrerender();
489 EXPECT_EQ(toWebURL("http://rel-next-only.com/"), relNextOnly.url()); 490 EXPECT_EQ(toWebURL("http://rel-next-only.com/"), relNextOnly.url());
490 EXPECT_EQ(PrerenderRelTypeNext, relNextOnly.relTypes()); 491 EXPECT_EQ(PrerenderRelTypeNext, relNextOnly.relTypes());
491 492
492 WebPrerender relNextAndPrerender = prerendererClient()->releaseWebPrerender( ); 493 WebPrerender relNextAndPrerender = prerendererClient()->releaseWebPrerender( );
493 EXPECT_EQ(toWebURL("http://rel-next-and-prerender.com/"), relNextAndPrerende r.url()); 494 EXPECT_EQ(toWebURL("http://rel-next-and-prerender.com/"), relNextAndPrerende r.url());
494 EXPECT_EQ(static_cast<unsigned>(PrerenderRelTypeNext | PrerenderRelTypePrere nder), relNextAndPrerender.relTypes()); 495 EXPECT_EQ(static_cast<unsigned>(PrerenderRelTypeNext | PrerenderRelTypePrere nder), relNextAndPrerender.relTypes());
495 } 496 }
496 497
497 } // namespace 498 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/MHTMLTest.cpp ('k') | third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698