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

Side by Side Diff: third_party/WebKit/Source/platform/testing/URLTestHelpers.h

Issue 2654933003: platform/testing/{URL|Unit}TestHelpers improvements (Closed)
Patch Set: windows build fix 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 /* 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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 #ifndef URLTestHelpers_h 31 #ifndef URLTestHelpers_h
32 #define URLTestHelpers_h 32 #define URLTestHelpers_h
33 33
34 #include "platform/weborigin/KURL.h" 34 #include "platform/weborigin/KURL.h"
35 #include "public/platform/WebString.h" 35 #include "public/platform/WebString.h"
36 #include "public/platform/WebURL.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 class WebURL;
40 class WebURLResponse; 40 class WebURLResponse;
41 41
42 namespace URLTestHelpers { 42 namespace URLTestHelpers {
43 43
44 inline blink::KURL toKURL(const std::string& url) { 44 inline blink::KURL toKURL(const std::string& url) {
45 WTF::String wtfString(url.c_str()); 45 WTF::String wtfString(url.c_str());
46 return blink::KURL(blink::ParsedURLString, wtfString); 46 return blink::KURL(blink::ParsedURLString, wtfString);
47 } 47 }
48 48
49 // Helper functions for mock URLs. These functions set up the desired URL and 49 // Helper functions for mock URLs. These functions set up the desired URL and
50 // mimeType, with a 200 OK return status. 50 // mimeType, with a 200 OK return status.
51 // For the mock URL, fullURL == baseURL + fileName. 51 // For the mock URL, fullURL == baseURL + fileName.
52 // For the actual file path: 52 // For the actual file path, filePath == basePath + ("/" +) fileName.
53 // <WebKit root directory> + relativeBaseDirectory + fileName, 53 // |basePath| or |filePath| could be obtained though UnitTestHelpers.
kinuko 2017/01/27 15:50:40 though -> through What do you mean by 'filePath'
Takashi Toyoshima 2017/02/06 08:14:55 Done. |filePath| means the argument of registerMo
54 // or, if the relative base directory is not specified: 54
55 // <WebKit root directory> + fileName. 55 // Returns fullURL that was calculated from |baseURL| and |fileName|.
56 // 56 WebURL registerMockedURLLoadFromBase(
57 void registerMockedURLFromBaseURL(
58 const WebString& baseURL, 57 const WebString& baseURL,
58 const WebString& basePath,
59 const WebString& fileName, 59 const WebString& fileName,
60 const WebString& mimeType = WebString::fromUTF8("text/html")); 60 const WebString& mimeType = WebString::fromUTF8("text/html"));
61 void registerMockedURLLoad( 61 void registerMockedURLLoad(
62 const WebURL& fullURL, 62 const WebURL& fullURL,
63 const WebString& fileName, 63 const WebString& filePath,
64 const WebString& mimeType = WebString::fromUTF8("text/html")); 64 const WebString& mimeType = WebString::fromUTF8("text/html"));
65 void registerMockedURLLoad(const WebURL& fullURL, 65 void registerMockedURLLoadWithCustomResponse(const WebURL& fullURL,
66 const WebString& fileName, 66 const WebString& filePath,
67 const WebString& relativeBaseDirectory, 67 WebURLResponse);
68 const WebString& mimeType);
69 void registerMockedURLLoadWithCustomResponse(
70 const WebURL& fullURL,
71 const WebString& fileName,
72 const WebString& relativeBaseDirectory,
73 WebURLResponse);
74 void registerMockedErrorURLLoad(const WebURL& fullURL); 68 void registerMockedErrorURLLoad(const WebURL& fullURL);
75 69
76 } // namespace URLTestHelpers 70 } // namespace URLTestHelpers
77 } // namespace blink 71 } // namespace blink
78 72
79 #endif 73 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698