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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentTestHelper.cpp

Issue 2967013002: Be explicit about namespace testing to not mix it with blink::testing (Closed)
Patch Set: Dropped mojo parts that need another review. Created 3 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/payments/PaymentTestHelper.h" 5 #include "modules/payments/PaymentTestHelper.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "modules/payments/PaymentCurrencyAmount.h" 8 #include "modules/payments/PaymentCurrencyAmount.h"
9 #include "modules/payments/PaymentMethodData.h" 9 #include "modules/payments/PaymentMethodData.h"
10 #include "platform/bindings/ScriptState.h" 10 #include "platform/bindings/ScriptState.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 SecurityOrigin::Create(KURL(NullURL(), "https://www.example.com/"))); 206 SecurityOrigin::Create(KURL(NullURL(), "https://www.example.com/")));
207 } 207 }
208 208
209 PaymentRequestMockFunctionScope::PaymentRequestMockFunctionScope( 209 PaymentRequestMockFunctionScope::PaymentRequestMockFunctionScope(
210 ScriptState* script_state) 210 ScriptState* script_state)
211 : script_state_(script_state) {} 211 : script_state_(script_state) {}
212 212
213 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() { 213 PaymentRequestMockFunctionScope::~PaymentRequestMockFunctionScope() {
214 v8::MicrotasksScope::PerformCheckpoint(script_state_->GetIsolate()); 214 v8::MicrotasksScope::PerformCheckpoint(script_state_->GetIsolate());
215 for (MockFunction* mock_function : mock_functions_) { 215 for (MockFunction* mock_function : mock_functions_) {
216 testing::Mock::VerifyAndClearExpectations(mock_function); 216 ::testing::Mock::VerifyAndClearExpectations(mock_function);
217 } 217 }
218 } 218 }
219 219
220 v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectCall( 220 v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectCall(
221 String* captor) { 221 String* captor) {
222 mock_functions_.push_back(new MockFunction(script_state_, captor)); 222 mock_functions_.push_back(new MockFunction(script_state_, captor));
223 EXPECT_CALL(*mock_functions_.back(), Call(testing::_)); 223 EXPECT_CALL(*mock_functions_.back(), Call(::testing::_));
224 return mock_functions_.back()->Bind(); 224 return mock_functions_.back()->Bind();
225 } 225 }
226 226
227 v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectCall() { 227 v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectCall() {
228 mock_functions_.push_back(new MockFunction(script_state_)); 228 mock_functions_.push_back(new MockFunction(script_state_));
229 EXPECT_CALL(*mock_functions_.back(), Call(testing::_)); 229 EXPECT_CALL(*mock_functions_.back(), Call(::testing::_));
230 return mock_functions_.back()->Bind(); 230 return mock_functions_.back()->Bind();
231 } 231 }
232 232
233 v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectNoCall() { 233 v8::Local<v8::Function> PaymentRequestMockFunctionScope::ExpectNoCall() {
234 mock_functions_.push_back(new MockFunction(script_state_)); 234 mock_functions_.push_back(new MockFunction(script_state_));
235 EXPECT_CALL(*mock_functions_.back(), Call(testing::_)).Times(0); 235 EXPECT_CALL(*mock_functions_.back(), Call(::testing::_)).Times(0);
236 return mock_functions_.back()->Bind(); 236 return mock_functions_.back()->Bind();
237 } 237 }
238 238
239 ACTION_P(SaveValueIn, captor) { 239 ACTION_P(SaveValueIn, captor) {
240 *captor = ToCoreString(arg0.V8Value() 240 *captor = ToCoreString(arg0.V8Value()
241 ->ToString(arg0.GetScriptState()->GetContext()) 241 ->ToString(arg0.GetScriptState()->GetContext())
242 .ToLocalChecked()); 242 .ToLocalChecked());
243 } 243 }
244 244
245 PaymentRequestMockFunctionScope::MockFunction::MockFunction( 245 PaymentRequestMockFunctionScope::MockFunction::MockFunction(
246 ScriptState* script_state) 246 ScriptState* script_state)
247 : ScriptFunction(script_state) { 247 : ScriptFunction(script_state) {
248 ON_CALL(*this, Call(testing::_)).WillByDefault(testing::ReturnArg<0>()); 248 ON_CALL(*this, Call(::testing::_)).WillByDefault(::testing::ReturnArg<0>());
249 } 249 }
250 250
251 PaymentRequestMockFunctionScope::MockFunction::MockFunction( 251 PaymentRequestMockFunctionScope::MockFunction::MockFunction(
252 ScriptState* script_state, 252 ScriptState* script_state,
253 String* captor) 253 String* captor)
254 : ScriptFunction(script_state), value_(captor) { 254 : ScriptFunction(script_state), value_(captor) {
255 ON_CALL(*this, Call(testing::_)) 255 ON_CALL(*this, Call(::testing::_))
256 .WillByDefault( 256 .WillByDefault(
257 testing::DoAll(SaveValueIn(value_), testing::ReturnArg<0>())); 257 ::testing::DoAll(SaveValueIn(value_), ::testing::ReturnArg<0>()));
258 } 258 }
259 259
260 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::Bind() { 260 v8::Local<v8::Function> PaymentRequestMockFunctionScope::MockFunction::Bind() {
261 return BindToV8Function(); 261 return BindToV8Function();
262 } 262 }
263 263
264 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698