| 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/web_state_impl.h" | 5 #import "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 EXPECT_FALSE(delegate.load_progress_changed_called()); | 410 EXPECT_FALSE(delegate.load_progress_changed_called()); |
| 411 web_state_->SendChangeLoadProgress(0.0); | 411 web_state_->SendChangeLoadProgress(0.0); |
| 412 EXPECT_TRUE(delegate.load_progress_changed_called()); | 412 EXPECT_TRUE(delegate.load_progress_changed_called()); |
| 413 | 413 |
| 414 // Test that HandleContextMenu() is called. | 414 // Test that HandleContextMenu() is called. |
| 415 EXPECT_FALSE(delegate.handle_context_menu_called()); | 415 EXPECT_FALSE(delegate.handle_context_menu_called()); |
| 416 web::ContextMenuParams context_menu_params; | 416 web::ContextMenuParams context_menu_params; |
| 417 web_state_->HandleContextMenu(context_menu_params); | 417 web_state_->HandleContextMenu(context_menu_params); |
| 418 EXPECT_TRUE(delegate.handle_context_menu_called()); | 418 EXPECT_TRUE(delegate.handle_context_menu_called()); |
| 419 | 419 |
| 420 // Test that ShowRepostFormWarningDialog() is called. |
| 421 EXPECT_FALSE(delegate.last_repost_form_request()); |
| 422 base::Callback<void(bool)> repost_callback; |
| 423 web_state_->ShowRepostFormWarningDialog(repost_callback); |
| 424 ASSERT_TRUE(delegate.last_repost_form_request()); |
| 425 EXPECT_EQ(delegate.last_repost_form_request()->web_state, web_state_.get()); |
| 426 |
| 420 // Test that GetJavaScriptDialogPresenter() is called. | 427 // Test that GetJavaScriptDialogPresenter() is called. |
| 421 TestJavaScriptDialogPresenter* presenter = | 428 TestJavaScriptDialogPresenter* presenter = |
| 422 delegate.GetTestJavaScriptDialogPresenter(); | 429 delegate.GetTestJavaScriptDialogPresenter(); |
| 423 EXPECT_FALSE(delegate.get_java_script_dialog_presenter_called()); | 430 EXPECT_FALSE(delegate.get_java_script_dialog_presenter_called()); |
| 424 EXPECT_TRUE(presenter->requested_dialogs().empty()); | 431 EXPECT_TRUE(presenter->requested_dialogs().empty()); |
| 425 EXPECT_FALSE(presenter->cancel_dialogs_called()); | 432 EXPECT_FALSE(presenter->cancel_dialogs_called()); |
| 426 | 433 |
| 427 __block bool callback_called = false; | 434 __block bool callback_called = false; |
| 428 web_state_->RunJavaScriptDialog(GURL(), JAVASCRIPT_DIALOG_TYPE_ALERT, @"", | 435 web_state_->RunJavaScriptDialog(GURL(), JAVASCRIPT_DIALOG_TYPE_ALERT, @"", |
| 429 nil, base::BindBlock(^(bool, NSString*) { | 436 nil, base::BindBlock(^(bool, NSString*) { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 "</script>"); | 673 "</script>"); |
| 667 | 674 |
| 668 base::test::ios::WaitUntilCondition(^{ | 675 base::test::ios::WaitUntilCondition(^{ |
| 669 return message_received; | 676 return message_received; |
| 670 }); | 677 }); |
| 671 web_state_->RemoveScriptCommandCallback("test"); | 678 web_state_->RemoveScriptCommandCallback("test"); |
| 672 } | 679 } |
| 673 | 680 |
| 674 } // namespace | 681 } // namespace |
| 675 } // namespace web | 682 } // namespace web |
| OLD | NEW |