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

Side by Side Diff: ppapi/proxy/raw_var_data_unittest.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « ppapi/proxy/raw_var_data.cc ('k') | ppapi/proxy/resource_message_params.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ppapi/proxy/raw_var_data.h" 5 #include "ppapi/proxy/raw_var_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 }; 50 };
51 51
52 bool WriteAndRead(const PP_Var& var, PP_Var* result) { 52 bool WriteAndRead(const PP_Var& var, PP_Var* result) {
53 PP_Instance dummy_instance = 1234; 53 PP_Instance dummy_instance = 1234;
54 scoped_ptr<RawVarDataGraph> expected_data(RawVarDataGraph::Create( 54 scoped_ptr<RawVarDataGraph> expected_data(RawVarDataGraph::Create(
55 var, dummy_instance)); 55 var, dummy_instance));
56 if (!expected_data) 56 if (!expected_data)
57 return false; 57 return false;
58 IPC::Message m; 58 IPC::Message m;
59 expected_data->Write(&m, base::Bind(&DefaultHandleWriter)); 59 expected_data->Write(&m, base::Bind(&DefaultHandleWriter));
60 PickleIterator iter(m); 60 base::PickleIterator iter(m);
61 scoped_ptr<RawVarDataGraph> actual_data(RawVarDataGraph::Read(&m, &iter)); 61 scoped_ptr<RawVarDataGraph> actual_data(RawVarDataGraph::Read(&m, &iter));
62 *result = actual_data->CreatePPVar(dummy_instance); 62 *result = actual_data->CreatePPVar(dummy_instance);
63 return true; 63 return true;
64 } 64 }
65 65
66 // Assumes a ref for var. 66 // Assumes a ref for var.
67 bool WriteReadAndCompare(const PP_Var& var) { 67 bool WriteReadAndCompare(const PP_Var& var) {
68 ScopedPPVar expected(ScopedPPVar::PassRef(), var); 68 ScopedPPVar expected(ScopedPPVar::PassRef(), var);
69 PP_Var result; 69 PP_Var result;
70 bool success = WriteAndRead(expected.get(), &result); 70 bool success = WriteAndRead(expected.get(), &result);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ScopedPPVar::PassRef(), 193 ScopedPPVar::PassRef(),
194 PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(34)); 194 PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(34));
195 EXPECT_TRUE(WriteReadAndCompare(resource.get())); 195 EXPECT_TRUE(WriteReadAndCompare(resource.get()));
196 196
197 // TODO(mgiuca): Test a host resource with an IPC::Message. It is currently a 197 // TODO(mgiuca): Test a host resource with an IPC::Message. It is currently a
198 // checkfail to deserialize such a resource. 198 // checkfail to deserialize such a resource.
199 } 199 }
200 200
201 } // namespace proxy 201 } // namespace proxy
202 } // namespace ppapi 202 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/raw_var_data.cc ('k') | ppapi/proxy/resource_message_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698