summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 16:16:05 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 16:16:05 +0000
commit835ddb1efa93056484b6ef0ab726f91c80dc9dc0 (patch)
tree52ba52898978e3ae387100c2f5b7533115003c32 /ppapi/tests
parent97e6c4c6081444371405bb39c99b016a65a309b8 (diff)
downloadchromium_src-835ddb1efa93056484b6ef0ab726f91c80dc9dc0.zip
chromium_src-835ddb1efa93056484b6ef0ab726f91c80dc9dc0.tar.gz
chromium_src-835ddb1efa93056484b6ef0ab726f91c80dc9dc0.tar.bz2
Add a test that passes an extra parameter, make sure nothing happens.
Question: Is 'nothing' what we want to have happen? BUG=None TEST=This test. Review URL: http://codereview.chromium.org/7031031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_post_message.cc23
-rw-r--r--ppapi/tests/test_post_message.h4
2 files changed, 27 insertions, 0 deletions
diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc
index d8cbb8d..a97ba42 100644
--- a/ppapi/tests/test_post_message.cc
+++ b/ppapi/tests/test_post_message.cc
@@ -34,6 +34,7 @@ void TestPostMessage::RunTest() {
RUN_TEST(SendingData);
RUN_TEST(MessageEvent);
RUN_TEST(NoHandler);
+ RUN_TEST(ExtraParam);
}
void TestPostMessage::HandleMessage(const pp::Var& message_data) {
@@ -219,3 +220,25 @@ std::string TestPostMessage::TestNoHandler() {
PASS();
}
+std::string TestPostMessage::TestExtraParam() {
+ // Delete any lingering event listeners.
+ ASSERT_TRUE(ClearListeners());
+ // Add a listener that will respond with 1 and an empty array (where the
+ // message port array would appear if it was Worker postMessage).
+ ASSERT_TRUE(AddEchoingListener("1, []"));
+
+ // Now send a message. We shouldn't get a response.
+ message_data_.clear();
+ instance_->PostMessage(pp::Var());
+ // Note that at this point, if we call RunMessageLoop, we should hang, because
+ // there should be no call to our HandleMessage function to quit the loop.
+ // Therefore, we will do CallOnMainThread to yield control. That event should
+ // fire, but we should see no messages when we return.
+ TestCompletionCallback callback(instance_->pp_instance());
+ pp::Module::Get()->core()->CallOnMainThread(0, callback);
+ callback.WaitForResult();
+ ASSERT_TRUE(message_data_.empty());
+
+ PASS();
+}
+
diff --git a/ppapi/tests/test_post_message.h b/ppapi/tests/test_post_message.h
index 3b58ba2..df7256b 100644
--- a/ppapi/tests/test_post_message.h
+++ b/ppapi/tests/test_post_message.h
@@ -49,6 +49,10 @@ class TestPostMessage : public TestCase {
// Test sending a message when no handler exists, make sure nothing happens.
std::string TestNoHandler();
+ // Test sending from JavaScript to the plugin with extra parameters, make sure
+ // nothing happens.
+ std::string TestExtraParam();
+
typedef std::vector<pp::Var> VarVector;
// This is used to store pp::Var objects we receive via a call to