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

Side by Side Diff: ios/web/test/wk_web_view_crash_utils.mm

Issue 2272133002: [ios] Updated CreateMockWKWebViewWithStubbedJSEvalFunction comments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ios/web/test/wk_web_view_crash_utils.h" 5 #import "ios/web/test/wk_web_view_crash_utils.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #include "base/ios/ios_util.h" 10 #include "base/ios/ios_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #import "base/mac/scoped_nsobject.h" 12 #import "base/mac/scoped_nsobject.h"
13 #include "ios/web/public/test/test_browser_state.h" 13 #include "ios/web/public/test/test_browser_state.h"
14 #import "ios/web/public/web_view_creation_util.h" 14 #import "ios/web/public/web_view_creation_util.h"
15 #import "third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h" 15 #import "third_party/ocmock/OCMock/NSInvocation+OCMAdditions.h"
16 #import "third_party/ocmock/OCMock/OCMock.h" 16 #import "third_party/ocmock/OCMock/OCMock.h"
17 17
18 namespace { 18 namespace {
19 19
20 // Returns an OCMocked WKWebView whose |evaluateJavaScript:stringResultHandler:| 20 // Returns an OCMocked WKWebView whose |evaluateJavaScript:completionHandler:|
21 // method has been mocked to execute |block| instead. |block| cannot be nil. 21 // method has been mocked to execute |block| instead. |block| cannot be nil.
22 WKWebView* CreateMockWKWebViewWithStubbedJSEvalFunction( 22 WKWebView* CreateMockWKWebViewWithStubbedJSEvalFunction(
23 void (^block)(NSInvocation*)) { 23 void (^block)(NSInvocation*)) {
24 DCHECK(block); 24 DCHECK(block);
25 web::TestBrowserState browser_state; 25 web::TestBrowserState browser_state;
26 base::scoped_nsobject<WKWebView> webView( 26 base::scoped_nsobject<WKWebView> webView(
27 web::CreateWKWebView(CGRectZero, &browser_state)); 27 web::CreateWKWebView(CGRectZero, &browser_state));
28 id mockWebView = [OCMockObject partialMockForObject:webView]; 28 id mockWebView = [OCMockObject partialMockForObject:webView];
29 [[[mockWebView stub] andDo:^void(NSInvocation* invocation) { 29 [[[mockWebView stub] andDo:^void(NSInvocation* invocation) {
30 block(invocation); 30 block(invocation);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 id succeed = ^void(NSInvocation* invocation) { 65 id succeed = ^void(NSInvocation* invocation) {
66 void (^completionHandler)(id, NSError*) = 66 void (^completionHandler)(id, NSError*) =
67 [invocation getArgumentAtIndexAsObject:3]; 67 [invocation getArgumentAtIndexAsObject:3];
68 // Always succceeds with nil result. 68 // Always succceeds with nil result.
69 completionHandler(nil, nil); 69 completionHandler(nil, nil);
70 }; 70 };
71 return CreateMockWKWebViewWithStubbedJSEvalFunction(succeed); 71 return CreateMockWKWebViewWithStubbedJSEvalFunction(succeed);
72 } 72 }
73 73
74 } // namespace web 74 } // namespace web
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698