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

Side by Side Diff: third_party/WebKit/Source/platform/testing/URLTestHelpers.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 17 matching lines...) Expand all
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 "platform/testing/URLTestHelpers.h" 31 #include "platform/testing/URLTestHelpers.h"
32 32
33 #include "platform/testing/UnitTestHelpers.h" 33 #include "platform/testing/UnitTestHelpers.h"
34 #include "public/platform/Platform.h" 34 #include "public/platform/Platform.h"
35 #include "public/platform/WebURL.h" 35 #include "public/platform/WebURL.h"
36 #include "public/platform/WebURLError.h" 36 #include "public/platform/WebURLError.h"
37 #include "public/platform/WebURLLoadTiming.h" 37 #include "public/platform/WebURLLoadTiming.h"
38 #include "public/platform/WebURLLoaderMockFactory.h"
38 #include "public/platform/WebURLResponse.h" 39 #include "public/platform/WebURLResponse.h"
39 #include "public/platform/WebUnitTestSupport.h"
40 40
41 namespace blink { 41 namespace blink {
42 namespace URLTestHelpers { 42 namespace URLTestHelpers {
43 43
44 void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fil eName, const WebString& mimeType) 44 void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fil eName, const WebString& mimeType)
45 { 45 {
46 // fullURL = baseURL + fileName. 46 // fullURL = baseURL + fileName.
47 std::string fullString = std::string(baseURL.utf8().data()) + std::string(fi leName.utf8().data()); 47 std::string fullString = std::string(baseURL.utf8().data()) + std::string(fi leName.utf8().data());
48 registerMockedURLLoad(toKURL(fullString.c_str()), fileName, WebString::fromU TF8(""), mimeType); 48 registerMockedURLLoad(toKURL(fullString.c_str()), fileName, WebString::fromU TF8(""), mimeType);
49 } 49 }
(...skipping 22 matching lines...) Expand all
72 timing.initialize(); 72 timing.initialize();
73 73
74 WebURLResponse response; 74 WebURLResponse response;
75 response.initialize(); 75 response.initialize();
76 response.setMIMEType("image/png"); 76 response.setMIMEType("image/png");
77 response.setHTTPStatusCode(404); 77 response.setHTTPStatusCode(404);
78 response.setLoadTiming(timing); 78 response.setLoadTiming(timing);
79 79
80 WebURLError error; 80 WebURLError error;
81 error.reason = 404; 81 error.reason = 404;
82 Platform::current()->unitTestSupport()->registerMockedErrorURL(fullURL, resp onse, error); 82 Platform::current()->getURLLoaderMockFactory()->registerErrorURL(fullURL, re sponse, error);
83 } 83 }
84 84
85 void registerMockedURLLoadWithCustomResponse(const WebURL& fullURL, const WebStr ing& fileName, const WebString& relativeBaseDirectory, WebURLResponse response) 85 void registerMockedURLLoadWithCustomResponse(const WebURL& fullURL, const WebStr ing& fileName, const WebString& relativeBaseDirectory, WebURLResponse response)
86 { 86 {
87 // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName. 87 // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName.
88 String filePath = testing::blinkRootDir(); 88 String filePath = testing::blinkRootDir();
89 filePath.append("/Source/web/tests/data/"); 89 filePath.append("/Source/web/tests/data/");
90 filePath.append(relativeBaseDirectory); 90 filePath.append(relativeBaseDirectory);
91 filePath.append(fileName); 91 filePath.append(fileName);
92 92
93 Platform::current()->unitTestSupport()->registerMockedURL(fullURL, response, filePath); 93 Platform::current()->getURLLoaderMockFactory()->registerURL(fullURL, respons e, filePath);
94 } 94 }
95 95
96 } // namespace URLTestHelpers 96 } // namespace URLTestHelpers
97 } // namespace blink 97 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698