diff options
4 files changed, 62 insertions, 0 deletions
@@ -57,6 +57,9 @@ deps = { "src/native_client": "http://nativeclient.googlecode.com/svn/trunk/src/native_client@" + Var("nacl_revision"), + "src/chrome/test/data/extensions/api_test/permissions/nacl_enabled/bin": + "http://nativeclient.googlecode.com/svn/trunk/src/native_client/tests/prebuilt@" + + Var("nacl_revision"), "src/third_party/skia/src": "http://skia.googlecode.com/svn/trunk/src@" + Var("skia_revision"), diff --git a/chrome/browser/extensions/permissions_apitest.cc b/chrome/browser/extensions/permissions_apitest.cc index 82c4068..b86940a 100644 --- a/chrome/browser/extensions/permissions_apitest.cc +++ b/chrome/browser/extensions/permissions_apitest.cc @@ -41,3 +41,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExperimentalPermissionsFail) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FavIconPermission) { ASSERT_TRUE(RunExtensionTest("permissions/favicon")) << message_; } + +// TODO(gregoryd): run the NaCl test on all systems once +// http://code.google.com/p/chromium/issues/detail?id=51335 is fixed. +// Meanwhile we run it on Mac OSX only, since we can be sure that an x86-32 NaCl +// module will work there. +#if defined(OS_MACOSX) +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NaClPermissionEnabled) { + ASSERT_TRUE(RunExtensionTest("permissions/nacl_enabled")) << message_; +} +#endif diff --git a/chrome/test/data/extensions/api_test/permissions/nacl_enabled/background.html b/chrome/test/data/extensions/api_test/permissions/nacl_enabled/background.html new file mode 100644 index 0000000..a813fe8 --- /dev/null +++ b/chrome/test/data/extensions/api_test/permissions/nacl_enabled/background.html @@ -0,0 +1,42 @@ +<script> +// OnNaClLoad should be called and invoking a method +// in a NaCl module should return a correct value. + +var pass = chrome.test.callbackPass; + +chrome.test.runTests([ + function nacl() { + // Nothing to do here, + // we call the callback when we get the notification from NaCl + } +]); + +function OnNaClLoad() { + try { + plugin = document.getElementById('pluginobj'); + result = plugin.helloworld(); + if ('hello, world.' != result) { + chrome.test.fail(); + } + } catch(e) { + chrome.test.fail(); + } + chrome.test.succeed(); +} + +function OnNaClFail() { + chrome.test.fail(); +} +</script> + +<h1>Native Client SRPC Simple Plug-in</h1> +<p> + <embed name="nacl_module" + id="pluginobj" + width=0 height=0 + src="bin/x86/srpc_hw.nexe" + type="application/x-nacl-srpc" + onload="OnNaClLoad()" + onfail="OnNaClFail()" + /> +</p> diff --git a/chrome/test/data/extensions/api_test/permissions/nacl_enabled/manifest.json b/chrome/test/data/extensions/api_test/permissions/nacl_enabled/manifest.json new file mode 100644 index 0000000..c37d815 --- /dev/null +++ b/chrome/test/data/extensions/api_test/permissions/nacl_enabled/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "nacl permission enabled apitest", + "description": "nacl permission enabled extension", + "version": "0.1", + "background_page": "background.html", + "permissions": [ "native_client" ] +} |