| OLD | NEW |
| 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 "base/memory/ptr_util.h" |
| 10 #include "ios/web/public/test/scoped_testing_web_client.h" | 10 #include "ios/web/public/test/scoped_testing_web_client.h" |
| 11 #include "ios/web/public/test/test_browser_state.h" | 11 #include "ios/web/public/test/test_browser_state.h" |
| 12 #import "ios/web/public/test/test_web_client.h" | 12 #import "ios/web/public/test/test_web_client.h" |
| 13 #include "ios/web/public/test/web_test.h" |
| 13 #import "ios/web/public/web_view_creation_util.h" | 14 #import "ios/web/public/web_view_creation_util.h" |
| 14 #import "ios/web/test/web_test.h" | |
| 15 #include "third_party/ocmock/OCMock/OCMock.h" | 15 #include "third_party/ocmock/OCMock/OCMock.h" |
| 16 #include "third_party/ocmock/gtest_support.h" | 16 #include "third_party/ocmock/gtest_support.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Returns WKScriptMessage mock. | 20 // Returns WKScriptMessage mock. |
| 21 id GetScriptMessageMock(WKWebView* web_view, NSString* name) { | 21 id GetScriptMessageMock(WKWebView* web_view, NSString* name) { |
| 22 id result = [OCMockObject mockForClass:[WKScriptMessage class]]; | 22 id result = [OCMockObject mockForClass:[WKScriptMessage class]]; |
| 23 [[[result stub] andReturn:web_view] webView]; | 23 [[[result stub] andReturn:web_view] webView]; |
| 24 [[[result stub] andReturn:name] name]; | 24 [[[result stub] andReturn:name] name]; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 didReceiveScriptMessage:message1]; | 193 didReceiveScriptMessage:message1]; |
| 194 [router_ userContentController:controller_mock_ | 194 [router_ userContentController:controller_mock_ |
| 195 didReceiveScriptMessage:message2]; | 195 didReceiveScriptMessage:message2]; |
| 196 [router_ userContentController:controller_mock_ | 196 [router_ userContentController:controller_mock_ |
| 197 didReceiveScriptMessage:message3]; | 197 didReceiveScriptMessage:message3]; |
| 198 | 198 |
| 199 EXPECT_EQ(3, last_called_handler); | 199 EXPECT_EQ(3, last_called_handler); |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace | 202 } // namespace |
| OLD | NEW |