Commit 88bfb430 authored by cstefansen@google.com's avatar cstefansen@google.com

Adjust PPAPI tests so they can also be run in the NaCl build using PyAuto.

TEST= See https://sites.google.com/a/chromium.org/dev/developers/design-documents/pepper-plugin-implementation for running in Chrome.
BUG= http://code.google.com/p/nativeclient/issues/detail?id=1671
Review URL: http://codereview.chromium.org/7049021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86356 0039d316-1c4b-4281-b951-d872f2087c98
parent 5eb52542
......@@ -6,23 +6,64 @@ Import('env')
ppapi_tests_target = 'ppapi_tests_%s.nexe' % env.get('TARGET_FULLARCH')
ppapi_tests_sources = [
# Common test files
'test_case.cc',
'test_utils.cc',
'testing_instance.cc',
# Compile-time tests
'test_c_includes.c',
'test_cpp_includes.cc',
'test_struct_sizes.c',
# Test cases (PLEASE KEEP THIS SECTION IN ALPHABETICAL ORDER)
# Add/uncomment PPAPI interfaces below when they get proxied.
#'test_buffer.cc',
#'test_char_set.cc',
#'test_directory_reader.cc',
#'test_file_io.cc',
#'test_file_ref.cc',
#'test_file_system.cc',
'test_graphics_2d.cc',
'test_image_data.cc',
'test_paint_aggregator.cc',
'test_post_message.cc',
'test_scrollbar.cc',
#'test_transport.cc',
#'test_uma.cc',
# Activating the URL loader test requires a test httpd that
# understands HTTP POST, which our current httpd.py doesn't.
# It also requires deactivating the tests that use FileIOTrusted
# when running in NaCl.
#'test_url_loader.cc',
#'test_url_util.cc',
#'test_video_decoder.cc',
# Deprecated test cases.
'test_instance_deprecated.cc',
# Var_deprecated fails in TestPassReference, and we probably won't
# fix it.
#'test_var_deprecated.cc'
]
ppapi_tests_nexe = env.ComponentProgram(ppapi_tests_target,
[Glob('*.cc')],
EXTRA_LIBS=['ppruntime',
'ppapi_cpp',
'platform',
'imc',
'gio',
'pthread',
'srpc'])
ppapi_tests_sources,
EXTRA_LIBS=['${PPAPI_LIBS}',
'ppapi_cpp'
])
# Note that the html is required to run this program.
# To run, load page with mode=nacl search string:
# http://localhost:5103/scons-out/nacl-x86-32/staging/test_case.html?mode=nacl
# http://localhost:5103/scons-out/nacl-x86-64/staging/test_case.html?mode=nacl
env.Publish(ppapi_tests_nexe, 'run',
['test_case.html',
env.Publish(ppapi_tests_target, 'run',
['test_url_loader_data/*'], subdir='test_url_loader_data')
env.Publish(ppapi_tests_target, 'run',
[ppapi_tests_nexe,
'test_case.html',
'test_case.nmf',
'test_image_data',
'test_page.css',
'test_url_loader_data'])
\ No newline at end of file
'test_page.css'])
......@@ -72,14 +72,15 @@ onload = function() {
document.title = 'Test ' + testcase;
var obj;
if (mode == "nacl") {
obj = document.createElement("OBJECT");
obj = document.createElement("EMBED");
obj.setAttribute("src", "test_case.nmf");
obj.setAttribute("type", "application/x-nacl");
obj.setAttribute("nacl", "test_case.nmf");
obj.setAttribute("mode", mode);
} else {
var mimeType = "application/x-ppapi-tests";
if (mimeType in navigator.mimeTypes) {
obj = document.createElement("EMBED");
obj.setAttribute("src", "http://a.b.c/test");
obj.setAttribute("type", mimeType);
} else {
document.getElementById("console").innerHTML =
......@@ -90,7 +91,6 @@ onload = function() {
if (obj) {
obj.setAttribute("id", "plugin");
obj.setAttribute("testcase", testcase);
obj.setAttribute("src", "http://a.b.c/test");
document.getElementById("container").appendChild(obj);
}
}
......
......@@ -2,6 +2,6 @@
"nexes": {
"x86-64": "ppapi_tests_x86-64.nexe",
"x86-32": "ppapi_tests_x86-32.nexe",
"arm" : "ppapi_tests_arm.nexe",
"arm" : "ppapi_tests_arm.nexe"
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ const PPB_Testing_Dev* GetTestingInterface() {
std::string ReportError(const char* method, int32_t error) {
char error_as_string[12];
sprintf(error_as_string, "%d", error);
sprintf(error_as_string, "%d", static_cast<int>(error));
std::string result = method + std::string(" failed with error: ") +
error_as_string;
if (error == PP_ERROR_NOSPACE)
......
......@@ -53,7 +53,10 @@ bool TestingInstance::Init(uint32_t argc,
}
pp::Var TestingInstance::GetInstanceObject() {
if (current_case_)
return current_case_->GetTestObject();
return pp::Var(this, NULL);
}
void TestingInstance::HandleMessage(const pp::Var& message_data) {
......@@ -115,6 +118,10 @@ void TestingInstance::ExecuteTests(int32_t unused) {
errors_.append("FAIL: Only listed tests");
} else {
current_case_->RunTest();
// Automated PyAuto tests rely on finding the exact strings below.
LogHTML(errors_.empty() ?
"<span class=\"pass\">[SHUTDOWN]</span> All tests passed." :
"<span class=\"fail\">[SHUTDOWN]</span> Some tests failed.");
}
// Declare we're done by setting a cookie to either "PASS" or the errors.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment