Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/web_state/web_state_delegate_bridge.h" | 5 #import "ios/web/public/web_state/web_state_delegate_bridge.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 EXPECT_EQ(context_menu_params.menu_title, result_params->menu_title); | 90 EXPECT_EQ(context_menu_params.menu_title, result_params->menu_title); |
| 91 EXPECT_EQ(context_menu_params.link_url, result_params->link_url); | 91 EXPECT_EQ(context_menu_params.link_url, result_params->link_url); |
| 92 EXPECT_EQ(context_menu_params.src_url, result_params->src_url); | 92 EXPECT_EQ(context_menu_params.src_url, result_params->src_url); |
| 93 EXPECT_EQ(context_menu_params.referrer_policy, | 93 EXPECT_EQ(context_menu_params.referrer_policy, |
| 94 result_params->referrer_policy); | 94 result_params->referrer_policy); |
| 95 EXPECT_EQ(context_menu_params.view, result_params->view); | 95 EXPECT_EQ(context_menu_params.view, result_params->view); |
| 96 EXPECT_EQ(context_menu_params.location.x, result_params->location.x); | 96 EXPECT_EQ(context_menu_params.location.x, result_params->location.x); |
| 97 EXPECT_EQ(context_menu_params.location.y, result_params->location.y); | 97 EXPECT_EQ(context_menu_params.location.y, result_params->location.y); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Tests |ShowRepostFormWarningDialog| forwarding. | |
|
rohitrao (ping after 24h)
2017/01/24 14:15:13
Is it worth also testing that the default implemen
Eugene But (OOO till 7-30)
2017/01/24 21:33:11
Yep. Added the test.
| |
| 101 TEST_F(WebStateDelegateBridgeTest, ShowRepostFormWarningDialog) { | |
| 102 EXPECT_FALSE([delegate_ repostFormWarningRequested]); | |
| 103 EXPECT_FALSE([delegate_ webState]); | |
| 104 base::Callback<void(bool)> callback; | |
| 105 bridge_->ShowRepostFormWarningDialog(&test_web_state_, callback); | |
| 106 EXPECT_TRUE([delegate_ repostFormWarningRequested]); | |
| 107 EXPECT_EQ(&test_web_state_, [delegate_ webState]); | |
| 108 } | |
| 109 | |
| 100 // Tests |GetJavaScriptDialogPresenter| forwarding. | 110 // Tests |GetJavaScriptDialogPresenter| forwarding. |
| 101 TEST_F(WebStateDelegateBridgeTest, GetJavaScriptDialogPresenter) { | 111 TEST_F(WebStateDelegateBridgeTest, GetJavaScriptDialogPresenter) { |
| 102 EXPECT_FALSE([delegate_ javaScriptDialogPresenterRequested]); | 112 EXPECT_FALSE([delegate_ javaScriptDialogPresenterRequested]); |
| 103 bridge_->GetJavaScriptDialogPresenter(nullptr); | 113 bridge_->GetJavaScriptDialogPresenter(nullptr); |
| 104 EXPECT_TRUE([delegate_ javaScriptDialogPresenterRequested]); | 114 EXPECT_TRUE([delegate_ javaScriptDialogPresenterRequested]); |
| 105 } | 115 } |
| 106 | 116 |
| 107 // Tests |OnAuthRequired| forwarding. | 117 // Tests |OnAuthRequired| forwarding. |
| 108 TEST_F(WebStateDelegateBridgeTest, OnAuthRequired) { | 118 TEST_F(WebStateDelegateBridgeTest, OnAuthRequired) { |
| 109 EXPECT_FALSE([delegate_ authenticationRequested]); | 119 EXPECT_FALSE([delegate_ authenticationRequested]); |
| 110 EXPECT_FALSE([delegate_ webState]); | 120 EXPECT_FALSE([delegate_ webState]); |
| 111 base::scoped_nsobject<NSURLProtectionSpace> protection_space( | 121 base::scoped_nsobject<NSURLProtectionSpace> protection_space( |
| 112 [[NSURLProtectionSpace alloc] init]); | 122 [[NSURLProtectionSpace alloc] init]); |
| 113 base::scoped_nsobject<NSURLCredential> credential( | 123 base::scoped_nsobject<NSURLCredential> credential( |
| 114 [[NSURLCredential alloc] init]); | 124 [[NSURLCredential alloc] init]); |
| 115 WebStateDelegate::AuthCallback callback; | 125 WebStateDelegate::AuthCallback callback; |
| 116 bridge_->OnAuthRequired(&test_web_state_, protection_space.get(), | 126 bridge_->OnAuthRequired(&test_web_state_, protection_space.get(), |
| 117 credential.get(), callback); | 127 credential.get(), callback); |
| 118 EXPECT_TRUE([delegate_ authenticationRequested]); | 128 EXPECT_TRUE([delegate_ authenticationRequested]); |
| 119 EXPECT_EQ(&test_web_state_, [delegate_ webState]); | 129 EXPECT_EQ(&test_web_state_, [delegate_ webState]); |
| 120 } | 130 } |
| 121 | 131 |
| 122 } // namespace web | 132 } // namespace web |
| OLD | NEW |