OLD | NEW |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 registerMockedURLLoadWithCustomResponse(fullURL, fileName, relativeBaseDirec
tory, response); | 66 registerMockedURLLoadWithCustomResponse(fullURL, fileName, relativeBaseDirec
tory, response); |
67 } | 67 } |
68 | 68 |
69 void registerMockedErrorURLLoad(const WebURL& fullURL) | 69 void registerMockedErrorURLLoad(const WebURL& fullURL) |
70 { | 70 { |
71 WebURLLoadTiming timing; | 71 WebURLLoadTiming timing; |
72 timing.initialize(); | 72 timing.initialize(); |
73 | 73 |
74 WebURLResponse response; | 74 WebURLResponse response; |
75 response.initialize(); | |
76 response.setMIMEType("image/png"); | 75 response.setMIMEType("image/png"); |
77 response.setHTTPStatusCode(404); | 76 response.setHTTPStatusCode(404); |
78 response.setLoadTiming(timing); | 77 response.setLoadTiming(timing); |
79 | 78 |
80 WebURLError error; | 79 WebURLError error; |
81 error.reason = 404; | 80 error.reason = 404; |
82 Platform::current()->getURLLoaderMockFactory()->registerErrorURL(fullURL, re
sponse, error); | 81 Platform::current()->getURLLoaderMockFactory()->registerErrorURL(fullURL, re
sponse, error); |
83 } | 82 } |
84 | 83 |
85 void registerMockedURLLoadWithCustomResponse(const WebURL& fullURL, const WebStr
ing& fileName, const WebString& relativeBaseDirectory, WebURLResponse response) | 84 void registerMockedURLLoadWithCustomResponse(const WebURL& fullURL, const WebStr
ing& fileName, const WebString& relativeBaseDirectory, WebURLResponse response) |
86 { | 85 { |
87 // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory
+ fileName. | 86 // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory
+ fileName. |
88 String filePath = testing::blinkRootDir(); | 87 String filePath = testing::blinkRootDir(); |
89 filePath.append("/Source/web/tests/data/"); | 88 filePath.append("/Source/web/tests/data/"); |
90 filePath.append(relativeBaseDirectory); | 89 filePath.append(relativeBaseDirectory); |
91 filePath.append(fileName); | 90 filePath.append(fileName); |
92 | 91 |
93 Platform::current()->getURLLoaderMockFactory()->registerURL(fullURL, respons
e, filePath); | 92 Platform::current()->getURLLoaderMockFactory()->registerURL(fullURL, respons
e, filePath); |
94 } | 93 } |
95 | 94 |
96 } // namespace URLTestHelpers | 95 } // namespace URLTestHelpers |
97 } // namespace blink | 96 } // namespace blink |
OLD | NEW |