Bug 532208: Test for large streams

This commit is contained in:
Benjamin Smedberg 2010-02-26 13:07:58 -06:00
Родитель ee351fc953
Коммит 9d0046758a
5 изменённых файлов: 42 добавлений и 1 удалений

Просмотреть файл

@ -72,6 +72,8 @@ _MOCHITEST_FILES = \
test_cookies.html \
test_npn_timers.html \
test_npn_asynccall.html \
test_bug532208.html \
large-pic.jpg \
$(NULL)
# test_npruntime_npnsetexception.html \ Disabled for e10s

Двоичные данные
modules/plugin/test/mochitest/large-pic.jpg Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 96 KiB

Просмотреть файл

@ -0,0 +1,27 @@
<head>
<title>Test for correct async delivery of large streams, bug
532208</title>
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<body onload="setTimeout(runTests, 2000)">
<embed id="plugin1" type="application/x-test" width="400"
height="400" src="large-pic.jpg" functiontofail="npp_write_rpc" streammode="normal"></embed>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
function runTests() {
try {
document.getElementById('plugin1').getPaintCount();
ok(true, "Data delivery didn't crash");
}
catch (e) {
ok(false, "Data delivery crashed");
}
SimpleTest.finish();
}
</script>

Просмотреть файл

@ -429,6 +429,7 @@ getFuncFromString(const char* funcname)
{ FUNCTION_NPP_WRITEREADY, "npp_writeready" },
{ FUNCTION_NPP_WRITE, "npp_write" },
{ FUNCTION_NPP_DESTROYSTREAM, "npp_destroystream" },
{ FUNCTION_NPP_WRITE_RPC, "npp_write_rpc" },
{ FUNCTION_NONE, NULL }
};
int32_t i = 0;
@ -955,6 +956,16 @@ NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buf
// instanceData->err << "NPP_Write called even though NPP_WriteReady " <<
// "returned 0";
//}
if (instanceData->functionToFail == FUNCTION_NPP_WRITE_RPC) {
// Make an RPC call and pretend to consume the data
NPObject* windowObject = NULL;
NPN_GetValue(instance, NPNVWindowNPObject, &windowObject);
if (windowObject)
NPN_ReleaseObject(windowObject);
return len;
}
if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM) {
instanceData->err << "NPP_Write called";

Просмотреть файл

@ -57,7 +57,8 @@ typedef enum {
FUNCTION_NPP_NEWSTREAM,
FUNCTION_NPP_WRITEREADY,
FUNCTION_NPP_WRITE,
FUNCTION_NPP_DESTROYSTREAM
FUNCTION_NPP_DESTROYSTREAM,
FUNCTION_NPP_WRITE_RPC
} TestFunction;
typedef struct FunctionTable {