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

Side by Side Diff: content/renderer/pepper/pepper_url_request_unittest.cc

Issue 908363002: PPAPI: Make tests that disable the proxy lock re-enable it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add export Created 5 years, 10 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
OLDNEW
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 #include "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "content/public/common/user_agent.h" 6 #include "content/public/common/user_agent.h"
7 #include "content/public/test/render_view_test.h" 7 #include "content/public/test/render_view_test.h"
8 #include "content/renderer/pepper/url_request_info_util.h" 8 #include "content/renderer/pepper/url_request_info_util.h"
9 #include "ppapi/proxy/connection.h" 9 #include "ppapi/proxy/connection.h"
10 #include "ppapi/proxy/url_request_info_resource.h" 10 #include "ppapi/proxy/url_request_info_resource.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 namespace content { 52 namespace content {
53 53
54 class URLRequestInfoTest : public RenderViewTest { 54 class URLRequestInfoTest : public RenderViewTest {
55 public: 55 public:
56 // Note: using -1 as the instance value allows code in 56 // Note: using -1 as the instance value allows code in
57 // url_request_info_util.cc to detect that this is a test instance. 57 // url_request_info_util.cc to detect that this is a test instance.
58 URLRequestInfoTest() : pp_instance_(-1) {} 58 URLRequestInfoTest() : pp_instance_(-1) {}
59 59
60 void SetUp() override { 60 void SetUp() override {
61 RenderViewTest::SetUp(); 61 RenderViewTest::SetUp();
62 ppapi::ProxyLock::DisableLockingOnThreadForTest();
63
64 test_globals_.GetResourceTracker()->DidCreateInstance(pp_instance_); 62 test_globals_.GetResourceTracker()->DidCreateInstance(pp_instance_);
65 63
66 // This resource doesn't do IPC, so a null connection is fine. 64 // This resource doesn't do IPC, so a null connection is fine.
67 info_ = new URLRequestInfoResource( 65 info_ = new URLRequestInfoResource(
68 ppapi::proxy::Connection(), pp_instance_, URLRequestInfoData()); 66 ppapi::proxy::Connection(), pp_instance_, URLRequestInfoData());
69 } 67 }
70 68
71 void TearDown() override { 69 void TearDown() override {
72 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_); 70 test_globals_.GetResourceTracker()->DidDeleteInstance(pp_instance_);
73 RenderViewTest::TearDown(); 71 RenderViewTest::TearDown();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 105
108 bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) { 106 bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) {
109 return info_->SetBooleanProperty(prop, b); 107 return info_->SetBooleanProperty(prop, b);
110 } 108 }
111 bool SetStringProperty(PP_URLRequestProperty prop, const std::string& s) { 109 bool SetStringProperty(PP_URLRequestProperty prop, const std::string& s) {
112 return info_->SetStringProperty(prop, s); 110 return info_->SetStringProperty(prop, s);
113 } 111 }
114 112
115 PP_Instance pp_instance_; 113 PP_Instance pp_instance_;
116 114
115 // Disables locking for the duration of the test.
116 ppapi::ProxyLock::LockingDisablerForTest disable_locking_;
117
117 // Needs to be alive for resource tracking to work. 118 // Needs to be alive for resource tracking to work.
118 ppapi::TestGlobals test_globals_; 119 ppapi::TestGlobals test_globals_;
119 120
120 scoped_refptr<URLRequestInfoResource> info_; 121 scoped_refptr<URLRequestInfoResource> info_;
121 }; 122 };
122 123
123 TEST_F(URLRequestInfoTest, GetInterface) { 124 TEST_F(URLRequestInfoTest, GetInterface) {
124 const PPB_URLRequestInfo* request_info = 125 const PPB_URLRequestInfo* request_info =
125 ppapi::thunk::GetPPB_URLRequestInfo_1_0_Thunk(); 126 ppapi::thunk::GetPPB_URLRequestInfo_1_0_Thunk();
126 EXPECT_TRUE(request_info); 127 EXPECT_TRUE(request_info);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Test that we can set multiple header fields using \n delimiter. 234 // Test that we can set multiple header fields using \n delimiter.
234 EXPECT_TRUE( 235 EXPECT_TRUE(
235 SetStringProperty(PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz")); 236 SetStringProperty(PP_URLREQUESTPROPERTY_HEADERS, "foo: bar\nbar: baz"));
236 EXPECT_TRUE(IsExpected(GetHeaderValue("foo"), "bar")); 237 EXPECT_TRUE(IsExpected(GetHeaderValue("foo"), "bar"));
237 EXPECT_TRUE(IsExpected(GetHeaderValue("bar"), "baz")); 238 EXPECT_TRUE(IsExpected(GetHeaderValue("bar"), "baz"));
238 } 239 }
239 240
240 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody. 241 // TODO(bbudge) Unit tests for AppendDataToBody, AppendFileToBody.
241 242
242 } // namespace content 243 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_file_chooser_host_unittest.cc ('k') | ppapi/proxy/ppapi_proxy_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698