OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_TESTS_TEST_POST_MESSAGE_H_ | 5 #ifndef PPAPI_TESTS_TEST_POST_MESSAGE_H_ |
6 #define PPAPI_TESTS_TEST_POST_MESSAGE_H_ | 6 #define PPAPI_TESTS_TEST_POST_MESSAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Clear any listeners that have been added using AddEchoingListener by | 37 // Clear any listeners that have been added using AddEchoingListener by |
38 // calling removeEventListener for each. | 38 // calling removeEventListener for each. |
39 // Returns true on success, false on failure. | 39 // Returns true on success, false on failure. |
40 bool ClearListeners(); | 40 bool ClearListeners(); |
41 | 41 |
42 // Wait for pending messages; return the number of messages that were pending | 42 // Wait for pending messages; return the number of messages that were pending |
43 // at the time of invocation. | 43 // at the time of invocation. |
44 int WaitForMessages(); | 44 int WaitForMessages(); |
45 | 45 |
| 46 // Verifies that the given javascript assertions are true of the message |
| 47 // (|test_data|) passed via PostMessage(). |
| 48 std::string CheckMessageProperties( |
| 49 const pp::Var& test_data, |
| 50 const std::vector<std::string>& properties_to_check); |
| 51 |
46 // Test that we can send a message from Instance::Init. Note the actual | 52 // Test that we can send a message from Instance::Init. Note the actual |
47 // message is sent in TestPostMessage::Init, and this test simply makes sure | 53 // message is sent in TestPostMessage::Init, and this test simply makes sure |
48 // we got it. | 54 // we got it. |
49 std::string TestSendInInit(); | 55 std::string TestSendInInit(); |
50 | 56 |
51 // Test some basic functionality; make sure we can send data successfully | 57 // Test some basic functionality; make sure we can send data successfully |
52 // in both directions. | 58 // in both directions. |
53 std::string TestSendingData(); | 59 std::string TestSendingData(); |
54 | 60 |
55 // Test sending ArrayBuffer vars in both directions. | 61 // Test sending ArrayBuffer vars in both directions. |
56 std::string TestSendingArrayBuffer(); | 62 std::string TestSendingArrayBuffer(); |
57 | 63 |
| 64 // Test sending Array vars in both directions. |
| 65 std::string TestSendingArray(); |
| 66 |
| 67 // Test sending Dictionary vars in both directions. |
| 68 std::string TestSendingDictionary(); |
| 69 |
| 70 // Test sending a complex var with references and cycles in both directions. |
| 71 std::string TestSendingComplexVar(); |
| 72 |
58 // Test the MessageEvent object that JavaScript received to make sure it is | 73 // Test the MessageEvent object that JavaScript received to make sure it is |
59 // of the right type and has all the expected fields. | 74 // of the right type and has all the expected fields. |
60 std::string TestMessageEvent(); | 75 std::string TestMessageEvent(); |
61 | 76 |
62 // Test sending a message when no handler exists, make sure nothing happens. | 77 // Test sending a message when no handler exists, make sure nothing happens. |
63 std::string TestNoHandler(); | 78 std::string TestNoHandler(); |
64 | 79 |
65 // Test sending from JavaScript to the plugin with extra parameters, make sure | 80 // Test sending from JavaScript to the plugin with extra parameters, make sure |
66 // nothing happens. | 81 // nothing happens. |
67 std::string TestExtraParam(); | 82 std::string TestExtraParam(); |
68 | 83 |
69 // Test sending messages off of the main thread. | 84 // Test sending messages off of the main thread. |
70 std::string TestNonMainThread(); | 85 std::string TestNonMainThread(); |
71 | 86 |
72 typedef std::vector<pp::Var> VarVector; | 87 typedef std::vector<pp::Var> VarVector; |
73 | 88 |
74 // This is used to store pp::Var objects we receive via a call to | 89 // This is used to store pp::Var objects we receive via a call to |
75 // HandleMessage. | 90 // HandleMessage. |
76 VarVector message_data_; | 91 VarVector message_data_; |
77 }; | 92 }; |
78 | 93 |
79 #endif // PPAPI_TESTS_TEST_POST_MESSAGE_H_ | 94 #endif // PPAPI_TESTS_TEST_POST_MESSAGE_H_ |
80 | 95 |
OLD | NEW |