OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PAPPI_TESTS_TEST_FLASH_MESSAGE_LOOP_H_ | 5 #ifndef PAPPI_TESTS_TEST_FLASH_MESSAGE_LOOP_H_ |
6 #define PAPPI_TESTS_TEST_FLASH_MESSAGE_LOOP_H_ | 6 #define PAPPI_TESTS_TEST_FLASH_MESSAGE_LOOP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" |
11 #include "ppapi/tests/test_case.h" | 11 #include "ppapi/tests/test_case.h" |
12 #include "ppapi/utility/completion_callback_factory.h" | 12 #include "ppapi/utility/completion_callback_factory.h" |
13 | 13 |
14 namespace pp { | 14 namespace pp { |
15 namespace flash { | 15 namespace flash { |
16 class MessageLoop; | 16 class MessageLoop; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 class TestFlashMessageLoop : public TestCase { | 20 class TestFlashMessageLoop : public TestCase { |
21 public: | 21 public: |
22 explicit TestFlashMessageLoop(TestingInstance* instance); | 22 explicit TestFlashMessageLoop(TestingInstance* instance); |
23 virtual ~TestFlashMessageLoop(); | 23 ~TestFlashMessageLoop() override; |
24 | 24 |
25 // TestCase implementation. | 25 // TestCase implementation. |
26 virtual void RunTests(const std::string& filter); | 26 void RunTests(const std::string& filter) override; |
| 27 |
| 28 void clear_instance_so() { instance_so_ = nullptr; } |
| 29 |
| 30 void DidRunScriptCallback(); |
27 | 31 |
28 private: | 32 private: |
| 33 // ScriptableObject implementation. |
| 34 class InstanceSO; |
| 35 |
| 36 // TestCase protected overrides. |
| 37 pp::deprecated::ScriptableObject* CreateTestObject() override; |
| 38 |
29 std::string TestBasics(); | 39 std::string TestBasics(); |
30 std::string TestRunWithoutQuit(); | 40 std::string TestRunWithoutQuit(); |
| 41 std::string TestSuspendScriptCallbackWhileRunning(); |
31 | 42 |
| 43 void TestSuspendScriptCallbackTask(int32_t unused); |
32 void QuitMessageLoopTask(int32_t unused); | 44 void QuitMessageLoopTask(int32_t unused); |
33 void DestroyMessageLoopResourceTask(int32_t unused); | 45 void DestroyMessageLoopResourceTask(int32_t unused); |
34 | 46 |
35 pp::flash::MessageLoop* message_loop_; | 47 pp::flash::MessageLoop* message_loop_; |
| 48 |
| 49 // The scriptable object and result storage for the |
| 50 // SuspendScriptCallbackWhileRunning test. |
| 51 InstanceSO* instance_so_; |
| 52 bool suspend_script_callback_result_; |
| 53 |
36 pp::CompletionCallbackFactory<TestFlashMessageLoop> callback_factory_; | 54 pp::CompletionCallbackFactory<TestFlashMessageLoop> callback_factory_; |
37 }; | 55 }; |
38 | 56 |
39 #endif // PAPPI_TESTS_TEST_FLASH_MESSAGE_LOOP_H_ | 57 #endif // PAPPI_TESTS_TEST_FLASH_MESSAGE_LOOP_H_ |
OLD | NEW |