Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: ppapi/tests/test_post_message.h

Issue 6538028: A proposal for an initial postMessage interface. This will allow JavaScript ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
polina 2011/03/17 02:59:28 2011
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_TESTS_TEST_POST_MESSAGE_H_
6 #define PPAPI_TESTS_TEST_POST_MESSAGE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "ppapi/tests/test_case.h"
12
13 struct PPB_Testing_Dev;
14
15 class TestPostMessage : public TestCase {
16 public:
17 explicit TestPostMessage(TestingInstance* instance)
18 : TestCase(instance), testing_interface_(NULL) {}
19
20 private:
21 // TestCase implementation.
22 virtual bool Init();
23 virtual void RunTest();
24
25 // A handler for JS->Native calls to postMessage. Simply pushes
26 // the given value to the back of message_data_
27 virtual void HandleMessage(const pp::Var& message_data);
28
29 // Set the JavaScript onmessage handler to echo back some expression based on
30 // the message_event by passing it to postMessage. Returns true on success,
31 // false on failure.
32 bool MakeOnMessageEcho(const std::string& expression);
33
34 // Test some basic functionality; make sure we can send data successfully
35 // in both directions.
36 std::string TestSendingData();
37
38 // Test the MessageEvent object that JavaScript received to make sure it is
39 // of the right type and has all the expected fields.
40 std::string TestMessageEvent();
41
42 // Test sending a message when no handler exists, make sure nothing happens.
43 std::string TestNoHandler();
44
45 const PPB_Testing_Dev* testing_interface_;
46
47 // This is used to store pp::Var objects we receive via a call to
48 // HandleMessage.
49 std::vector<pp::Var> message_data_;
50 };
51
52 #endif // PPAPI_TESTS_TEST_POST_MESSAGE_H_
53
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698