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 #include "ios/chrome/browser/ssl/ios_ssl_error_handler.h" | 5 #include "ios/chrome/browser/ssl/ios_ssl_error_handler.h" |
6 | 6 |
7 #include "base/mac/bind_objc_block.h" | 7 #include "base/mac/bind_objc_block.h" |
8 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 8 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
9 #include "ios/web/public/interstitials/web_interstitial.h" | 9 #include "ios/web/public/interstitials/web_interstitial.h" |
10 #import "ios/web/public/test/web_test_with_web_state.h" | 10 #import "ios/web/public/test/web_test_with_web_state.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 IOSSSLErrorHandlerTest() | 28 IOSSSLErrorHandlerTest() |
29 : browser_state_(builder_.Build()), | 29 : browser_state_(builder_.Build()), |
30 cert_(net::ImportCertFromFile(net::GetTestCertsDirectory(), | 30 cert_(net::ImportCertFromFile(net::GetTestCertsDirectory(), |
31 kTestCertFileName)) {} | 31 kTestCertFileName)) {} |
32 | 32 |
33 // web::WebTestWithWebState overrides: | 33 // web::WebTestWithWebState overrides: |
34 void SetUp() override { | 34 void SetUp() override { |
35 web::WebTestWithWebState::SetUp(); | 35 web::WebTestWithWebState::SetUp(); |
36 ASSERT_TRUE(cert_); | 36 ASSERT_TRUE(cert_); |
37 ASSERT_FALSE(web_state()->IsShowingWebInterstitial()); | 37 ASSERT_FALSE(web_state()->IsShowingWebInterstitial()); |
| 38 |
| 39 // Transient item can only be added for pending non-app-specific loads. |
| 40 AddPendingItem(GURL(kTestHostName), |
| 41 ui::PageTransition::PAGE_TRANSITION_TYPED); |
38 } | 42 } |
39 web::BrowserState* GetBrowserState() override { return browser_state_.get(); } | 43 web::BrowserState* GetBrowserState() override { return browser_state_.get(); } |
40 | 44 |
41 // Returns certificate for testing. | 45 // Returns certificate for testing. |
42 scoped_refptr<net::X509Certificate> cert() { return cert_; } | 46 scoped_refptr<net::X509Certificate> cert() { return cert_; } |
43 | 47 |
44 private: | 48 private: |
45 TestChromeBrowserState::Builder builder_; | 49 TestChromeBrowserState::Builder builder_; |
46 std::unique_ptr<TestChromeBrowserState> browser_state_; | 50 std::unique_ptr<TestChromeBrowserState> browser_state_; |
47 scoped_refptr<net::X509Certificate> cert_; | 51 scoped_refptr<net::X509Certificate> cert_; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 113 |
110 // Make sure that interstitial is displayed. | 114 // Make sure that interstitial is displayed. |
111 EXPECT_TRUE(web_state()->IsShowingWebInterstitial()); | 115 EXPECT_TRUE(web_state()->IsShowingWebInterstitial()); |
112 web::WebInterstitial* interstitial = web_state()->GetWebInterstitial(); | 116 web::WebInterstitial* interstitial = web_state()->GetWebInterstitial(); |
113 EXPECT_TRUE(interstitial); | 117 EXPECT_TRUE(interstitial); |
114 | 118 |
115 // Make sure callback is called on dismissal. | 119 // Make sure callback is called on dismissal. |
116 interstitial->DontProceed(); | 120 interstitial->DontProceed(); |
117 EXPECT_TRUE(do_not_proceed_callback_called); | 121 EXPECT_TRUE(do_not_proceed_callback_called); |
118 } | 122 } |
OLD | NEW |