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

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

Issue 9174020: PPAPI URLRequestInfo test: port NaCl version to ppapi_tests. Fix Var and Resource leaks. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PAPPI_TESTS_TEST_URL_REQUEST_H_
6 #define PAPPI_TESTS_TEST_URL_REQUEST_H_
7
8 #include <string>
9
10 #include "ppapi/c/ppb_core.h"
11 #include "ppapi/c/ppb_url_loader.h"
12 #include "ppapi/c/ppb_url_request_info.h"
13 #include "ppapi/c/ppb_url_response_info.h"
14 #include "ppapi/c/ppb_var.h"
15 #include "ppapi/tests/test_case.h"
16
17 class TestURLRequest : public TestCase {
18 public:
19 explicit TestURLRequest(TestingInstance* instance);
20 ~TestURLRequest() { ppb_core_interface_->ReleaseResource(url_loader_); }
21
22 // TestCase implementation.
23 virtual bool Init();
24 virtual void RunTests(const std::string& filter);
25
26 private:
27 std::string TestCreate();
28 std::string TestIsURLRequestInfo();
29 std::string TestSetProperty();
30 std::string TestAppendDataToBody();
31 std::string TestStress();
32
33 // Helpers.
34 PP_Var PP_MakeString(const char* s);
35 std::string LoadAndCompareBody(PP_Resource url_request,
36 const std::string& expected_body);
37
38 struct PropertyTestData {
39 PropertyTestData(TestURLRequest* tester,
40 PP_URLRequestProperty _property,
41 const std::string& _property_name,
42 PP_Var _var, PP_Bool _expected_value) :
dmichael (off chromium) 2012/01/17 18:38:03 Please don't use leading underscores in names. It'
polina1 2012/01/26 02:56:26 This was a port of the NaCl code. I am not too kee
43 property(_property), property_name(_property_name),
44 var(_var), expected_value(_expected_value) {
45 // _var has ref count of 1 on creation.
46 }
47 PP_URLRequestProperty property;
48 std::string property_name;
49 PP_Var var;
dmichael (off chromium) 2012/01/17 18:38:03 You *might* need your destructor to release this v
polina1 2012/01/26 02:56:26 There are no leaks because the var is released at
50 PP_Bool expected_value;
51 };
bbudge 2012/01/16 16:24:29 struct could be hidden in the .cc file.
polina1 2012/01/26 02:56:26 done moved to the same spot where it was in the Na
52
53 const PPB_URLRequestInfo* ppb_url_request_interface_;
54 const PPB_URLLoader* ppb_url_loader_interface_;
55 const PPB_URLResponseInfo* ppb_url_response_interface_;
56 const PPB_Core* ppb_core_interface_;
57 const PPB_Var* ppb_var_interface_;
58
59 PP_Resource url_loader_;
60 };
61
62 #endif // PAPPI_TESTS_TEST_URL_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698