Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ppapi / tests / test_message_handler.h
blob51d231741c0d877dcf3cd1b4a7702564c268c3fc
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_TESTS_TEST_MESSAGE_HANDLER_H_
6 #define PPAPI_TESTS_TEST_MESSAGE_HANDLER_H_
8 #include <string>
9 #include <vector>
11 #include "ppapi/c/ppb_messaging.h"
12 #include "ppapi/tests/test_case.h"
13 #include "ppapi/tests/test_utils.h"
14 #include "ppapi/utility/threading/simple_thread.h"
16 class TestMessageHandler : public TestCase {
17 public:
18 explicit TestMessageHandler(TestingInstance* instance);
19 virtual ~TestMessageHandler();
21 private:
22 // TestCase implementation.
23 virtual bool Init();
24 virtual void RunTests(const std::string& filter);
25 virtual void HandleMessage(const pp::Var& message_data);
27 std::string TestRegisterErrorConditions();
28 std::string TestPostMessageAndAwaitResponse();
29 std::string TestExceptions();
31 // Wait for HandleMessage to be called, and return the Var it received.
32 pp::Var WaitForMessage();
33 NestedEvent message_received_;
34 pp::Var last_message_;
36 const PPB_Messaging_1_2* ppb_messaging_if_;
37 pp::SimpleThread handler_thread_;
41 #endif // PPAPI_TESTS_TEST_MESSAGE_HANDLER_H_