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

Unified Diff: Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp

Issue 16831015: fix mocking of various files in webkit_unit_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: wtf instead of std Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/WebKit/chromium/tests/WebPageSerializerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
index c752480ac0da8d8a33fc649aec4b16f3397fe293..1455c399d80d6e827b2de37500e7f086a00b3f47 100644
--- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
+++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp
@@ -79,9 +79,22 @@ public:
, m_runningMessageLoop(false)
{
// Reuse one of the test files from WebFrameTest.
- std::string filePath = std::string(Platform::current()->unitTestSupport()->webKitRootDir().utf8().data());
- filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html";
- m_frameFilePath = WebString::fromUTF8(filePath.c_str());
+ m_baseFilePath = Platform::current()->unitTestSupport()->webKitRootDir();
+ m_baseFilePath.append("/Source/WebKit/chromium/tests/data/");
+ m_frameFilePath = m_baseFilePath;
+ m_frameFilePath.append("iframes_test.html");
+ }
+
+ WebCore::KURL RegisterMockedUrl(const std::string& urlRoot, const WTF::String& filename)
+ {
+ WebURLResponse response;
+ response.initialize();
+ response.setMIMEType("text/html");
+ WTF::String localPath = m_baseFilePath;
+ localPath.append(filename);
+ WebCore::KURL url = toKURL(urlRoot + filename.utf8().data());
+ Platform::current()->unitTestSupport()->registerMockedURL(url, response, localPath);
+ return url;
}
void SetUp()
@@ -89,12 +102,16 @@ public:
m_webView = WebView::create(0);
m_webView->initializeMainFrame(&m_webFrameClient);
- // Load the frame before trying to load resources.
- WebCore::KURL url = toKURL("http://www.test.com/iframes_test.html");
- WebURLResponse response;
- response.initialize();
- response.setMIMEType("text/html");
- Platform::current()->unitTestSupport()->registerMockedURL(url, response, m_frameFilePath);
+ std::string urlRoot = "http://www.test.com/";
+ WebCore::KURL url = RegisterMockedUrl(urlRoot, "iframes_test.html");
+ const char* iframeSupportFiles[] = {
+ "invisible_iframe.html",
+ "visible_iframe.html",
+ "zero_sized_iframe.html",
+ };
+ for (size_t i = 0; i < arraysize(iframeSupportFiles); ++i) {
+ RegisterMockedUrl(urlRoot, iframeSupportFiles[i]);
+ }
WebURLRequest request;
request.initialize();
@@ -262,7 +279,8 @@ public:
}
protected:
- WebString m_frameFilePath;
+ WTF::String m_baseFilePath;
+ WTF::String m_frameFilePath;
TestWebFrameClient m_webFrameClient;
WebView* m_webView;
« no previous file with comments | « no previous file | Source/WebKit/chromium/tests/WebPageSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698