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_URL_REQUEST_H_ | 5 #ifndef PAPPI_TESTS_TEST_URL_REQUEST_H_ |
6 #define PAPPI_TESTS_TEST_URL_REQUEST_H_ | 6 #define PAPPI_TESTS_TEST_URL_REQUEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
11 #include "ppapi/c/ppb_url_loader.h" | 11 #include "ppapi/c/ppb_url_loader.h" |
12 #include "ppapi/c/ppb_url_request_info.h" | 12 #include "ppapi/c/ppb_url_request_info.h" |
13 #include "ppapi/c/ppb_url_response_info.h" | 13 #include "ppapi/c/ppb_url_response_info.h" |
14 #include "ppapi/c/ppb_var.h" | 14 #include "ppapi/c/ppb_var.h" |
15 #include "ppapi/tests/test_case.h" | 15 #include "ppapi/tests/test_case.h" |
16 | 16 |
17 namespace pp { | 17 namespace pp { |
18 class FileRef; | 18 class FileRef; |
19 } | 19 } |
20 | 20 |
21 class TestURLRequest : public TestCase { | 21 class TestURLRequest : public TestCase { |
22 public: | 22 public: |
23 explicit TestURLRequest(TestingInstance* instance); | 23 explicit TestURLRequest(TestingInstance* instance); |
24 ~TestURLRequest() { ppb_core_interface_->ReleaseResource(url_loader_); } | |
25 | 24 |
26 // TestCase implementation. | 25 // TestCase implementation. |
27 virtual bool Init(); | 26 virtual bool Init(); |
28 virtual void RunTests(const std::string& filter); | 27 virtual void RunTests(const std::string& filter); |
29 | 28 |
30 private: | 29 private: |
31 std::string TestCreateAndIsURLRequestInfo(); | 30 std::string TestCreateAndIsURLRequestInfo(); |
32 std::string TestSetProperty(); | 31 std::string TestSetProperty(); |
33 std::string TestAppendDataToBody(); | 32 std::string TestAppendDataToBody(); |
34 std::string TestAppendFileToBody(); | 33 std::string TestAppendFileToBody(); |
35 std::string TestStress(); | 34 std::string TestStress(); |
36 | 35 |
37 // Helpers. | 36 // Helpers. |
38 PP_Var PP_MakeString(const char* s); | 37 PP_Var PP_MakeString(const char* s); |
39 std::string LoadAndCompareBody(PP_Resource url_request, | 38 std::string LoadAndCompareBody(PP_Resource url_request, |
40 const std::string& expected_body); | 39 const std::string& expected_body); |
41 | 40 |
42 const PPB_URLRequestInfo* ppb_url_request_interface_; | 41 const PPB_URLRequestInfo* ppb_url_request_interface_; |
43 const PPB_URLLoader* ppb_url_loader_interface_; | 42 const PPB_URLLoader* ppb_url_loader_interface_; |
44 const PPB_URLResponseInfo* ppb_url_response_interface_; | 43 const PPB_URLResponseInfo* ppb_url_response_interface_; |
45 const PPB_Core* ppb_core_interface_; | 44 const PPB_Core* ppb_core_interface_; |
46 const PPB_Var* ppb_var_interface_; | 45 const PPB_Var* ppb_var_interface_; |
47 | |
48 PP_Resource url_loader_; | |
49 }; | 46 }; |
50 | 47 |
51 #endif // PAPPI_TESTS_TEST_URL_REQUEST_H_ | 48 #endif // PAPPI_TESTS_TEST_URL_REQUEST_H_ |
OLD | NEW |