OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/web/test/web_test.h" | 5 #import "ios/web/test/web_test.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
11 #import "base/test/ios/wait_util.h" | 12 #import "base/test/ios/wait_util.h" |
12 #import "ios/testing/ocmock_complex_type_helper.h" | 13 #import "ios/testing/ocmock_complex_type_helper.h" |
13 #import "ios/web/navigation/crw_session_controller.h" | 14 #import "ios/web/navigation/crw_session_controller.h" |
14 #import "ios/web/net/crw_url_verifying_protocol_handler.h" | 15 #import "ios/web/net/crw_url_verifying_protocol_handler.h" |
15 #include "ios/web/public/active_state_manager.h" | 16 #include "ios/web/public/active_state_manager.h" |
16 #include "ios/web/public/referrer.h" | 17 #include "ios/web/public/referrer.h" |
17 #import "ios/web/public/web_state/ui/crw_web_delegate.h" | 18 #import "ios/web/public/web_state/ui/crw_web_delegate.h" |
18 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" | 19 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" |
19 #import "ios/web/web_state/web_state_impl.h" | 20 #import "ios/web/web_state/web_state_impl.h" |
(...skipping 10 matching lines...) Expand all Loading... |
30 mainDocumentURL:(const GURL&)mainDocumentURL | 31 mainDocumentURL:(const GURL&)mainDocumentURL |
31 linkClicked:(BOOL)linkClicked { | 32 linkClicked:(BOOL)linkClicked { |
32 return YES; | 33 return YES; |
33 } | 34 } |
34 @end | 35 @end |
35 | 36 |
36 namespace web { | 37 namespace web { |
37 | 38 |
38 #pragma mark - | 39 #pragma mark - |
39 | 40 |
40 WebTest::WebTest() : web_client_(make_scoped_ptr(new TestWebClient)) {} | 41 WebTest::WebTest() : web_client_(base::WrapUnique(new TestWebClient)) {} |
41 WebTest::~WebTest() {} | 42 WebTest::~WebTest() {} |
42 | 43 |
43 void WebTest::SetUp() { | 44 void WebTest::SetUp() { |
44 PlatformTest::SetUp(); | 45 PlatformTest::SetUp(); |
45 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); | 46 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); |
46 } | 47 } |
47 | 48 |
48 void WebTest::TearDown() { | 49 void WebTest::TearDown() { |
49 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); | 50 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); |
50 PlatformTest::TearDown(); | 51 PlatformTest::TearDown(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 JSONObjectWithData:evaluationData | 218 JSONObjectWithData:evaluationData |
218 options:0 | 219 options:0 |
219 error:&error]; | 220 error:&error]; |
220 DCHECK(dictionary && !error); | 221 DCHECK(dictionary && !error); |
221 NSString* exception = [dictionary objectForKey:@"exception"]; | 222 NSString* exception = [dictionary objectForKey:@"exception"]; |
222 CHECK(!exception) << "Script error: " << [exception UTF8String]; | 223 CHECK(!exception) << "Script error: " << [exception UTF8String]; |
223 return [dictionary objectForKey:@"result"]; | 224 return [dictionary objectForKey:@"result"]; |
224 } | 225 } |
225 | 226 |
226 CRWWebController* WebTestWithWebController::CreateWebController() { | 227 CRWWebController* WebTestWithWebController::CreateWebController() { |
227 scoped_ptr<WebStateImpl> web_state_impl(new WebStateImpl(GetBrowserState())); | 228 std::unique_ptr<WebStateImpl> web_state_impl( |
| 229 new WebStateImpl(GetBrowserState())); |
228 return [[CRWWKWebViewWebController alloc] | 230 return [[CRWWKWebViewWebController alloc] |
229 initWithWebState:std::move(web_state_impl)]; | 231 initWithWebState:std::move(web_state_impl)]; |
230 } | 232 } |
231 | 233 |
232 void WebTestWithWebController::WillProcessTask( | 234 void WebTestWithWebController::WillProcessTask( |
233 const base::PendingTask& pending_task) { | 235 const base::PendingTask& pending_task) { |
234 // Nothing to do. | 236 // Nothing to do. |
235 } | 237 } |
236 | 238 |
237 void WebTestWithWebController::DidProcessTask( | 239 void WebTestWithWebController::DidProcessTask( |
(...skipping 13 matching lines...) Expand all Loading... |
251 } | 253 } |
252 return false; | 254 return false; |
253 } | 255 } |
254 | 256 |
255 NSString* WebTestWithWebController::CreateLoadCheck() { | 257 NSString* WebTestWithWebController::CreateLoadCheck() { |
256 return [NSString stringWithFormat:@"<p style=\"display: none;\">%d</p>", | 258 return [NSString stringWithFormat:@"<p style=\"display: none;\">%d</p>", |
257 s_html_load_count++]; | 259 s_html_load_count++]; |
258 } | 260 } |
259 | 261 |
260 } // namespace web | 262 } // namespace web |
OLD | NEW |