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

Side by Side Diff: sandbox/win/src/service_resolver_unittest.cc

Issue 13888007: Rewrite scoped_array<T> to scoped_ptr<T[]> in sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « sandbox/win/src/service_resolver_64.cc ('k') | sandbox/win/src/win_utils.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 // This file contains unit tests for ServiceResolverThunk. 5 // This file contains unit tests for ServiceResolverThunk.
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "sandbox/win/src/resolver.h" 10 #include "sandbox/win/src/resolver.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return STATUS_UNSUCCESSFUL; 98 return STATUS_UNSUCCESSFUL;
99 99
100 BYTE service[50]; 100 BYTE service[50];
101 memcpy(service, target, sizeof(service)); 101 memcpy(service, target, sizeof(service));
102 102
103 static_cast<WinXpResolverTest*>(resolver)->set_target(service); 103 static_cast<WinXpResolverTest*>(resolver)->set_target(service);
104 104
105 // Any pointer will do as an interception_entry_point 105 // Any pointer will do as an interception_entry_point
106 void* function_entry = resolver; 106 void* function_entry = resolver;
107 size_t thunk_size = resolver->GetThunkSize(); 107 size_t thunk_size = resolver->GetThunkSize();
108 scoped_array<char> thunk(new char[thunk_size]); 108 scoped_ptr<char[]> thunk(new char[thunk_size]);
109 size_t used; 109 size_t used;
110 110
111 NTSTATUS ret = resolver->Setup(ntdll_base, NULL, function, NULL, 111 NTSTATUS ret = resolver->Setup(ntdll_base, NULL, function, NULL,
112 function_entry, thunk.get(), thunk_size, 112 function_entry, thunk.get(), thunk_size,
113 &used); 113 &used);
114 if (NT_SUCCESS(ret)) { 114 if (NT_SUCCESS(ret)) {
115 EXPECT_EQ(thunk_size, used); 115 EXPECT_EQ(thunk_size, used);
116 EXPECT_NE(0, memcmp(service, target, sizeof(service))); 116 EXPECT_NE(0, memcmp(service, target, sizeof(service)));
117 EXPECT_NE(kJump32, service[0]); 117 EXPECT_NE(kJump32, service[0]);
118 118
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 ::GetLastError(); 218 ::GetLastError();
219 219
220 ret = PatchNtdllWithResolver("NtMapViewOfSection", true, resolver); 220 ret = PatchNtdllWithResolver("NtMapViewOfSection", true, resolver);
221 EXPECT_EQ(STATUS_SUCCESS, ret) << "NtMapViewOfSection, last error: " << 221 EXPECT_EQ(STATUS_SUCCESS, ret) << "NtMapViewOfSection, last error: " <<
222 ::GetLastError(); 222 ::GetLastError();
223 delete resolver; 223 delete resolver;
224 #endif 224 #endif
225 } 225 }
226 226
227 } // namespace 227 } // namespace
OLDNEW
« no previous file with comments | « sandbox/win/src/service_resolver_64.cc ('k') | sandbox/win/src/win_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698