OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/public/test/fakes/test_java_script_dialog_presenter.h" | 5 #import "ios/web/public/test/fakes/test_java_script_dialog_presenter.h" |
6 | 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." |
| 9 #endif |
| 10 |
7 namespace web { | 11 namespace web { |
8 | 12 |
9 TestJavaScriptDialog::TestJavaScriptDialog() = default; | 13 TestJavaScriptDialog::TestJavaScriptDialog() = default; |
10 | 14 |
11 TestJavaScriptDialog::TestJavaScriptDialog(const TestJavaScriptDialog&) = | 15 TestJavaScriptDialog::TestJavaScriptDialog(const TestJavaScriptDialog&) = |
12 default; | 16 default; |
13 | 17 |
14 TestJavaScriptDialog::~TestJavaScriptDialog() = default; | 18 TestJavaScriptDialog::~TestJavaScriptDialog() = default; |
15 | 19 |
16 TestJavaScriptDialogPresenter::TestJavaScriptDialogPresenter() = default; | 20 TestJavaScriptDialogPresenter::TestJavaScriptDialogPresenter() = default; |
17 | 21 |
18 TestJavaScriptDialogPresenter::~TestJavaScriptDialogPresenter() = default; | 22 TestJavaScriptDialogPresenter::~TestJavaScriptDialogPresenter() = default; |
19 | 23 |
20 void TestJavaScriptDialogPresenter::RunJavaScriptDialog( | 24 void TestJavaScriptDialogPresenter::RunJavaScriptDialog( |
21 WebState* web_state, | 25 WebState* web_state, |
22 const GURL& origin_url, | 26 const GURL& origin_url, |
23 JavaScriptDialogType java_script_dialog_type, | 27 JavaScriptDialogType java_script_dialog_type, |
24 NSString* message_text, | 28 NSString* message_text, |
25 NSString* default_prompt_text, | 29 NSString* default_prompt_text, |
26 const DialogClosedCallback& callback) { | 30 const DialogClosedCallback& callback) { |
27 TestJavaScriptDialog dialog; | 31 TestJavaScriptDialog dialog; |
28 dialog.web_state = web_state; | 32 dialog.web_state = web_state; |
29 dialog.origin_url = origin_url; | 33 dialog.origin_url = origin_url; |
30 dialog.java_script_dialog_type = java_script_dialog_type; | 34 dialog.java_script_dialog_type = java_script_dialog_type; |
31 dialog.message_text.reset([message_text copy]); | 35 dialog.message_text = [message_text copy]; |
32 dialog.default_prompt_text.reset([default_prompt_text copy]); | 36 dialog.default_prompt_text = [default_prompt_text copy]; |
33 | 37 |
34 requested_dialogs_.push_back(dialog); | 38 requested_dialogs_.push_back(dialog); |
35 | 39 |
36 callback.Run(callback_success_argument_, callback_user_input_argument_.get()); | 40 callback.Run(callback_success_argument_, callback_user_input_argument_); |
37 } | 41 } |
38 | 42 |
39 void TestJavaScriptDialogPresenter::CancelDialogs(WebState* web_state) { | 43 void TestJavaScriptDialogPresenter::CancelDialogs(WebState* web_state) { |
40 cancel_dialogs_called_ = true; | 44 cancel_dialogs_called_ = true; |
41 } | 45 } |
42 | 46 |
43 } // namespace web | 47 } // namespace web |
OLD | NEW |