blob: 6fde9bfa2a481e291aa96f103d1a37766b5ee3eb [file] [log] [blame]
[email protected]de9bdd12010-11-04 00:36:221// Copyright (c) 2010 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.
4
5#ifndef PPAPI_TESTS_TEST_UTILS_H_
6#define PPAPI_TESTS_TEST_UTILS_H_
7
8#include <string>
9
10#include "ppapi/c/dev/ppb_testing_dev.h"
[email protected]7358d572011-02-15 18:44:4011#include "ppapi/c/pp_instance.h"
[email protected]de9bdd12010-11-04 00:36:2212#include "ppapi/c/pp_stdint.h"
13#include "ppapi/cpp/completion_callback.h"
14
15const PPB_Testing_Dev* GetTestingInterface();
16std::string ReportError(const char* method, int32_t error);
17
18class TestCompletionCallback {
19 public:
[email protected]7358d572011-02-15 18:44:4020 TestCompletionCallback(PP_Instance instance);
[email protected]de9bdd12010-11-04 00:36:2221
22 int32_t WaitForResult();
23
24 operator pp::CompletionCallback() const;
25
[email protected]64264ef2010-12-21 00:45:4326 unsigned run_count() const { return run_count_; }
27 void reset_run_count() { run_count_ = 0; }
28
[email protected]de9bdd12010-11-04 00:36:2229 private:
30 static void Handler(void* user_data, int32_t result);
31
32 int32_t result_;
33 bool post_quit_task_;
[email protected]64264ef2010-12-21 00:45:4334 unsigned run_count_;
[email protected]7358d572011-02-15 18:44:4035 PP_Instance instance_;
[email protected]de9bdd12010-11-04 00:36:2236};
37
38#endif // PPAPI_TESTS_TEST_UTILS_H_