| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ASSERT_FALSE([delegate_ webState]); | 62 ASSERT_FALSE([delegate_ webState]); |
| 63 ASSERT_FALSE([delegate_ webStateCreationRequested]); | 63 ASSERT_FALSE([delegate_ webStateCreationRequested]); |
| 64 | 64 |
| 65 EXPECT_FALSE( | 65 EXPECT_FALSE( |
| 66 bridge_->CreateNewWebState(&test_web_state_, GURL(), GURL(), true)); | 66 bridge_->CreateNewWebState(&test_web_state_, GURL(), GURL(), true)); |
| 67 | 67 |
| 68 EXPECT_EQ(&test_web_state_, [delegate_ webState]); | 68 EXPECT_EQ(&test_web_state_, [delegate_ webState]); |
| 69 ASSERT_TRUE([delegate_ webStateCreationRequested]); | 69 ASSERT_TRUE([delegate_ webStateCreationRequested]); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Tests |closeWebState:| forwarding. |
| 73 TEST_F(WebStateDelegateBridgeTest, CloseWebState) { |
| 74 ASSERT_FALSE([delegate_ webState]); |
| 75 ASSERT_FALSE([delegate_ webStateClosingRequested]); |
| 76 |
| 77 bridge_->CloseWebState(&test_web_state_); |
| 78 |
| 79 EXPECT_EQ(&test_web_state_, [delegate_ webState]); |
| 80 ASSERT_TRUE([delegate_ webStateClosingRequested]); |
| 81 } |
| 82 |
| 72 // Tests |webState:openURLWithParams:| forwarding. | 83 // Tests |webState:openURLWithParams:| forwarding. |
| 73 TEST_F(WebStateDelegateBridgeTest, OpenURLFromWebState) { | 84 TEST_F(WebStateDelegateBridgeTest, OpenURLFromWebState) { |
| 74 ASSERT_FALSE([delegate_ webState]); | 85 ASSERT_FALSE([delegate_ webState]); |
| 75 ASSERT_FALSE([delegate_ openURLParams]); | 86 ASSERT_FALSE([delegate_ openURLParams]); |
| 76 | 87 |
| 77 web::WebState::OpenURLParams params( | 88 web::WebState::OpenURLParams params( |
| 78 GURL("https://chromium.test/"), | 89 GURL("https://chromium.test/"), |
| 79 web::Referrer(GURL("https://chromium2.test/"), ReferrerPolicyNever), | 90 web::Referrer(GURL("https://chromium2.test/"), ReferrerPolicyNever), |
| 80 WindowOpenDisposition::NEW_WINDOW, ui::PAGE_TRANSITION_FORM_SUBMIT, true); | 91 WindowOpenDisposition::NEW_WINDOW, ui::PAGE_TRANSITION_FORM_SUBMIT, true); |
| 81 EXPECT_EQ(&test_web_state_, | 92 EXPECT_EQ(&test_web_state_, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 base::scoped_nsobject<NSURLCredential> credential( | 165 base::scoped_nsobject<NSURLCredential> credential( |
| 155 [[NSURLCredential alloc] init]); | 166 [[NSURLCredential alloc] init]); |
| 156 WebStateDelegate::AuthCallback callback; | 167 WebStateDelegate::AuthCallback callback; |
| 157 bridge_->OnAuthRequired(&test_web_state_, protection_space.get(), | 168 bridge_->OnAuthRequired(&test_web_state_, protection_space.get(), |
| 158 credential.get(), callback); | 169 credential.get(), callback); |
| 159 EXPECT_TRUE([delegate_ authenticationRequested]); | 170 EXPECT_TRUE([delegate_ authenticationRequested]); |
| 160 EXPECT_EQ(&test_web_state_, [delegate_ webState]); | 171 EXPECT_EQ(&test_web_state_, [delegate_ webState]); |
| 161 } | 172 } |
| 162 | 173 |
| 163 } // namespace web | 174 } // namespace web |
| OLD | NEW |