<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[171740] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/171740">171740</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-29 04:35:52 -0700 (Tue, 29 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement webkit_web_view_load_string() in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=134735
Reviewed by Sergio Villar Senin.
Source/WebKit2:
Add webkit_web_view_load_bytes() that receives a GBytes to load
random data in the web view using the given MIME-Type, encoding
and base URL.
* UIProcess/API/gtk/WebKitWebView.cpp:
(releaseGBytes):
(webkit_web_view_load_bytes):
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt:
Tools:
Add /webkit2/WebKitWebView/load-bytes test case and simplify
TestDOMXPathNSResolver by using webkit_web_view_load_bytes()
instead of a soup server just to sent the Content-type header.
* TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp:
(testWebKitDOMXPathNSResolverNative):
(testWebKitDOMXPathNSResolverCustom):
(beforeAll):
(afterAll):
(serverCallback): Deleted.
* TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
(testLoadBytes):
(beforeAll):
* TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp:
(LoadTrackingTest::loadBytes):
* TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.h:
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
(WebViewTest::loadBytes):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestDOMXPathNSResolvercpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestLoaderClientcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkLoadTrackingTestcpp">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkLoadTrackingTesth">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTesth">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-07-29 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Implement webkit_web_view_load_string() in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=134735
+
+ Reviewed by Sergio Villar Senin.
+
+ Add webkit_web_view_load_bytes() that receives a GBytes to load
+ random data in the web view using the given MIME-Type, encoding
+ and base URL.
+
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (releaseGBytes):
+ (webkit_web_view_load_bytes):
+ * UIProcess/API/gtk/WebKitWebView.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt:
+
</ins><span class="cx"> 2014-07-29 Ryuan Choi <ryuan.choi@samsung.com>
</span><span class="cx">
</span><span class="cx"> [EFL] Alpha value of ewk_view_bg_color_set is not working
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -2135,7 +2135,46 @@
</span><span class="cx"> getPage(webView)->loadPlainTextString(String::fromUTF8(plainText));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void releaseGBytes(unsigned char*, const void* bytes)
+{
+ // Balanced by g_bytes_ref in webkit_web_view_load_bytes().
+ g_bytes_unref(static_cast<GBytes*>(const_cast<void*>(bytes)));
+}
+
</ins><span class="cx"> /**
</span><ins>+ * webkit_web_view_load_bytes:
+ * @web_view: a #WebKitWebView
+ * @bytes: input data to load
+ * @mime_type: (allow-none): the MIME type of @bytes, or %NULL
+ * @encoding: (allow-none): the character encoding of @bytes, or %NULL
+ * @base_uri: (allow-none): the base URI for relative locations or %NULL
+ *
+ * Load the specified @bytes into @web_view using the given @mime_type and @encoding.
+ * When @mime_type is %NULL, it defaults to "text/html".
+ * When @encoding is %NULL, it defaults to "UTF-8".
+ * When @base_uri is %NULL, it defaults to "about:blank".
+ * You can monitor the load operation by connecting to #WebKitWebView::load-changed signal.
+ *
+ * Since: 2.6
+ */
+void webkit_web_view_load_bytes(WebKitWebView* webView, GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+ g_return_if_fail(bytes);
+
+ gsize bytesDataSize;
+ gconstpointer bytesData = g_bytes_get_data(bytes, &bytesDataSize);
+ g_return_if_fail(bytesDataSize);
+
+ // Balanced by g_bytes_unref in releaseGBytes.
+ g_bytes_ref(bytes);
+
+ RefPtr<API::Data> data = API::Data::createWithoutCopying(static_cast<const unsigned char*>(bytesData), bytesDataSize, releaseGBytes, bytes);
+ getPage(webView)->loadData(data.get(), mimeType ? String::fromUTF8(mimeType) : String::fromUTF8("text/html"),
+ encoding ? String::fromUTF8(encoding) : String::fromUTF8("UTF-8"), String::fromUTF8(baseURI));
+}
+
+/**
</ins><span class="cx"> * webkit_web_view_load_request:
</span><span class="cx"> * @web_view: a #WebKitWebView
</span><span class="cx"> * @request: a #WebKitURIRequest to load
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -288,6 +288,13 @@
</span><span class="cx"> const gchar *plain_text);
</span><span class="cx">
</span><span class="cx"> WEBKIT_API void
</span><ins>+webkit_web_view_load_bytes (WebKitWebView *web_view,
+ GBytes *bytes,
+ const gchar *mime_type,
+ const gchar *encoding,
+ const gchar *base_uri);
+
+WEBKIT_API void
</ins><span class="cx"> webkit_web_view_load_request (WebKitWebView *web_view,
</span><span class="cx"> WebKitURIRequest *request);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -69,5 +69,10 @@
</span><span class="cx"> <xi:include href="xml/api-index-2.4.xml"><xi:fallback /></xi:include>
</span><span class="cx"> </index>
</span><span class="cx">
</span><ins>+ <index id="api-index-2-6" role="2.6">
+ <title>Index of new symbols in 2.6</title>
+ <xi:include href="xml/api-index-2.6.xml"><xi:fallback /></xi:include>
+ </index>
+
</ins><span class="cx"> <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</span><span class="cx"> </book>
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtksectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -143,6 +143,7 @@
</span><span class="cx"> webkit_web_view_load_html
</span><span class="cx"> webkit_web_view_load_alternate_html
</span><span class="cx"> webkit_web_view_load_plain_text
</span><ins>+webkit_web_view_load_bytes
</ins><span class="cx"> webkit_web_view_load_request
</span><span class="cx"> webkit_web_view_can_go_back
</span><span class="cx"> webkit_web_view_go_back
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/ChangeLog        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-07-29 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ Implement webkit_web_view_load_string() in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=134735
+
+ Reviewed by Sergio Villar Senin.
+
+ Add /webkit2/WebKitWebView/load-bytes test case and simplify
+ TestDOMXPathNSResolver by using webkit_web_view_load_bytes()
+ instead of a soup server just to sent the Content-type header.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp:
+ (testWebKitDOMXPathNSResolverNative):
+ (testWebKitDOMXPathNSResolverCustom):
+ (beforeAll):
+ (afterAll):
+ (serverCallback): Deleted.
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
+ (testLoadBytes):
+ (beforeAll):
+ * TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp:
+ (LoadTrackingTest::loadBytes):
+ * TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.h:
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
+ (WebViewTest::loadBytes):
+ * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h:
+
</ins><span class="cx"> 2014-07-28 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> Add support for running the Clang static analyzer when building WebKit and JSC
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestDOMXPathNSResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestDOMXPathNSResolver.cpp        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -19,14 +19,12 @@
</span><span class="cx">
</span><span class="cx"> #include "config.h"
</span><span class="cx">
</span><del>-#include "WebKitTestServer.h"
</del><span class="cx"> #include "WebProcessTestRunner.h"
</span><span class="cx"> #include "WebViewTest.h"
</span><span class="cx"> #include <gtk/gtk.h>
</span><span class="cx"> #include <webkit2/webkit2.h>
</span><span class="cx">
</span><span class="cx"> static WebProcessTestRunner* testRunner;
</span><del>-static WebKitTestServer* kServer;
</del><span class="cx">
</span><span class="cx"> static void runTest(WebViewTest* test, const char* name)
</span><span class="cx"> {
</span><span class="lines">@@ -38,46 +36,24 @@
</span><span class="cx">
</span><span class="cx"> static void testWebKitDOMXPathNSResolverNative(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><del>- test->loadURI(kServer->getURIForPath("/native").data());
</del><ins>+ static const char* nativeXML = "<root xmlns:foo='http://www.example.org'><foo:child>SUCCESS</foo:child></root>";
+ GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_static(nativeXML, strlen(nativeXML)));
+ test->loadBytes(bytes.get(), "text/xml", nullptr, nullptr);
</ins><span class="cx"> test->waitUntilLoadFinished();
</span><span class="cx"> runTest(test, "native");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void testWebKitDOMXPathNSResolverCustom(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><del>- test->loadURI(kServer->getURIForPath("/custom").data());
</del><ins>+ static const char* customXML = "<root xmlns='http://www.example.com'><child>SUCCESS</child></root>";
+ GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_static(customXML, strlen(customXML)));
+ test->loadBytes(bytes.get(), "text/xml", nullptr, nullptr);
</ins><span class="cx"> test->waitUntilLoadFinished();
</span><span class="cx"> runTest(test, "custom");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
-{
- if (message->method != SOUP_METHOD_GET) {
- soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
- return;
- }
-
- if (g_str_equal(path, "/native")) {
- soup_message_set_status(message, SOUP_STATUS_OK);
- soup_message_headers_append(message->response_headers, "Content-Type", "text/xml");
- static const char* nativeXML = "<root xmlns:foo='http://www.example.org'><foo:child>SUCCESS</foo:child></root>";
- soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, nativeXML, strlen(nativeXML));
- soup_message_body_complete(message->response_body);
- } else if (g_str_equal(path, "/custom")) {
- soup_message_set_status(message, SOUP_STATUS_OK);
- soup_message_headers_append(message->response_headers, "Content-Type", "text/xml");
- static const char* customXML = "<root xmlns='http://www.example.com'><child>SUCCESS</child></root>";
- soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, customXML, strlen(customXML));
- soup_message_body_complete(message->response_body);
- } else
- soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
-}
-
</del><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><del>- kServer = new WebKitTestServer();
- kServer->run(serverCallback);
-
</del><span class="cx"> testRunner = new WebProcessTestRunner();
</span><span class="cx"> webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR);
</span><span class="cx">
</span><span class="lines">@@ -88,5 +64,4 @@
</span><span class="cx"> void afterAll()
</span><span class="cx"> {
</span><span class="cx"> delete testRunner;
</span><del>- delete kServer;
</del><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -89,6 +89,18 @@
</span><span class="cx"> assertNormalLoadHappened(test->m_loadEvents);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void testLoadBytes(LoadTrackingTest* test, gconstpointer)
+{
+ GUniquePtr<char> filePath(g_build_filename(Test::getResourcesDir().data(), "blank.ico", nullptr));
+ char* contents;
+ gsize contentsLength;
+ g_file_get_contents(filePath.get(), &contents, &contentsLength, nullptr);
+ GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_take(contents, contentsLength));
+ test->loadBytes(bytes.get(), "image/vnd.microsoft.icon", nullptr, nullptr);
+ test->waitUntilLoadFinished();
+ assertNormalLoadHappened(test->m_loadEvents);
+}
+
</ins><span class="cx"> static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx"> GRefPtr<WebKitURIRequest> request(webkit_uri_request_new(kServer->getURIForPath("/normal").data()));
</span><span class="lines">@@ -442,6 +454,7 @@
</span><span class="cx"> LoadTrackingTest::add("WebKitWebView", "load-html", testLoadHtml);
</span><span class="cx"> LoadTrackingTest::add("WebKitWebView", "load-alternate-html", testLoadAlternateHTML);
</span><span class="cx"> LoadTrackingTest::add("WebKitWebView", "load-plain-text", testLoadPlainText);
</span><ins>+ LoadTrackingTest::add("WebKitWebView", "load-bytes", testLoadBytes);
</ins><span class="cx"> LoadTrackingTest::add("WebKitWebView", "load-request", testLoadRequest);
</span><span class="cx"> LoadStopTrackingTest::add("WebKitWebView", "stop-loading", testLoadCancelled);
</span><span class="cx"> LoadTrackingTest::add("WebKitWebView", "title", testWebViewTitle);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkLoadTrackingTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -174,6 +174,14 @@
</span><span class="cx"> WebViewTest::loadPlainText(plainText);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void LoadTrackingTest::loadBytes(GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI)
+{
+ m_loadEvents.clear();
+ m_estimatedProgress = 0;
+ m_error.reset();
+ WebViewTest::loadBytes(bytes, mimeType, encoding, baseURI);
+}
+
</ins><span class="cx"> void LoadTrackingTest::loadRequest(WebKitURIRequest* request)
</span><span class="cx"> {
</span><span class="cx"> m_loadEvents.clear();
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkLoadTrackingTesth"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.h (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.h        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.h        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> void loadHtml(const char* html, const char* baseURI);
</span><span class="cx"> void loadPlainText(const char* plainText);
</span><span class="cx"> void loadRequest(WebKitURIRequest*);
</span><ins>+ void loadBytes(GBytes*, const char* mimeType, const char* encoding, const char* baseURI);
</ins><span class="cx"> void reload();
</span><span class="cx"> void goBack();
</span><span class="cx"> void goForward();
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -71,6 +71,15 @@
</span><span class="cx"> webkit_web_view_load_plain_text(m_webView, plainText);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebViewTest::loadBytes(GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI)
+{
+ if (!baseURI)
+ m_activeURI = "about:blank";
+ else
+ m_activeURI = baseURI;
+ webkit_web_view_load_bytes(m_webView, bytes, mimeType, encoding, baseURI);
+}
+
</ins><span class="cx"> void WebViewTest::loadRequest(WebKitURIRequest* request)
</span><span class="cx"> {
</span><span class="cx"> m_activeURI = webkit_uri_request_get_uri(request);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTesth"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h (171739 => 171740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h        2014-07-29 08:52:49 UTC (rev 171739)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.h        2014-07-29 11:35:52 UTC (rev 171740)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> virtual void loadHtml(const char* html, const char* baseURI);
</span><span class="cx"> virtual void loadPlainText(const char* plainText);
</span><span class="cx"> virtual void loadRequest(WebKitURIRequest*);
</span><ins>+ virtual void loadBytes(GBytes*, const char* mimeType, const char* encoding, const char* baseURI);
</ins><span class="cx"> void loadAlternateHTML(const char* html, const char* contentURI, const char* baseURI);
</span><span class="cx"> void goBack();
</span><span class="cx"> void goForward();
</span></span></pre>
</div>
</div>
</body>
</html>