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

Side by Side Diff: ios/web/web_state/ui/crw_wk_script_message_router_unittest.mm

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 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
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/web_state/ui/crw_wk_script_message_router.h" 5 #import "ios/web/web_state/ui/crw_wk_script_message_router.h"
6 6
7 #include "base/mac/scoped_block.h" 7 #include "base/mac/scoped_block.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/ptr_util.h"
9 #include "ios/web/public/test/scoped_testing_web_client.h" 10 #include "ios/web/public/test/scoped_testing_web_client.h"
10 #include "ios/web/public/test/test_browser_state.h" 11 #include "ios/web/public/test/test_browser_state.h"
11 #import "ios/web/public/test/test_web_client.h" 12 #import "ios/web/public/test/test_web_client.h"
12 #import "ios/web/public/web_view_creation_util.h" 13 #import "ios/web/public/web_view_creation_util.h"
13 #import "ios/web/test/web_test.h" 14 #import "ios/web/test/web_test.h"
14 #include "third_party/ocmock/OCMock/OCMock.h" 15 #include "third_party/ocmock/OCMock/OCMock.h"
15 #include "third_party/ocmock/gtest_support.h" 16 #include "third_party/ocmock/gtest_support.h"
16 17
17 namespace { 18 namespace {
18 19
19 // Returns WKScriptMessage mock. 20 // Returns WKScriptMessage mock.
20 id GetScriptMessageMock(WKWebView* web_view, NSString* name) { 21 id GetScriptMessageMock(WKWebView* web_view, NSString* name) {
21 id result = [OCMockObject mockForClass:[WKScriptMessage class]]; 22 id result = [OCMockObject mockForClass:[WKScriptMessage class]];
22 [[[result stub] andReturn:web_view] webView]; 23 [[[result stub] andReturn:web_view] webView];
23 [[[result stub] andReturn:name] name]; 24 [[[result stub] andReturn:name] name];
24 return result; 25 return result;
25 } 26 }
26 27
27 // Test fixture for CRWWKScriptMessageRouter. 28 // Test fixture for CRWWKScriptMessageRouter.
28 class CRWWKScriptMessageRouterTest : public web::WebTest { 29 class CRWWKScriptMessageRouterTest : public web::WebTest {
29 public: 30 public:
30 CRWWKScriptMessageRouterTest() 31 CRWWKScriptMessageRouterTest()
31 : web_client_(make_scoped_ptr(new web::WebClient)) {} 32 : web_client_(base::WrapUnique(new web::WebClient)) {}
32 33
33 protected: 34 protected:
34 void SetUp() override { 35 void SetUp() override {
35 web::WebTest::SetUp(); 36 web::WebTest::SetUp();
36 // Mock WKUserContentController object. 37 // Mock WKUserContentController object.
37 controller_mock_.reset( 38 controller_mock_.reset(
38 [[OCMockObject mockForClass:[WKUserContentController class]] retain]); 39 [[OCMockObject mockForClass:[WKUserContentController class]] retain]);
39 [controller_mock_ setExpectationOrderMatters:YES]; 40 [controller_mock_ setExpectationOrderMatters:YES];
40 41
41 // Create testable CRWWKScriptMessageRouter. 42 // Create testable CRWWKScriptMessageRouter.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 didReceiveScriptMessage:message1]; 193 didReceiveScriptMessage:message1];
193 [router_ userContentController:controller_mock_ 194 [router_ userContentController:controller_mock_
194 didReceiveScriptMessage:message2]; 195 didReceiveScriptMessage:message2];
195 [router_ userContentController:controller_mock_ 196 [router_ userContentController:controller_mock_
196 didReceiveScriptMessage:message3]; 197 didReceiveScriptMessage:message3];
197 198
198 EXPECT_EQ(3, last_called_handler); 199 EXPECT_EQ(3, last_called_handler);
199 } 200 }
200 201
201 } // namespace 202 } // namespace
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller_unittest.mm ('k') | ios/web/web_state/ui/crw_wk_web_view_web_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698