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); | |
42 } | 38 } |
43 web::BrowserState* GetBrowserState() override { return browser_state_.get(); } | 39 web::BrowserState* GetBrowserState() override { return browser_state_.get(); } |
44 | 40 |
45 // Returns certificate for testing. | 41 // Returns certificate for testing. |
46 scoped_refptr<net::X509Certificate> cert() { return cert_; } | 42 scoped_refptr<net::X509Certificate> cert() { return cert_; } |
47 | 43 |
48 private: | 44 private: |
49 TestChromeBrowserState::Builder builder_; | 45 TestChromeBrowserState::Builder builder_; |
50 std::unique_ptr<TestChromeBrowserState> browser_state_; | 46 std::unique_ptr<TestChromeBrowserState> browser_state_; |
51 scoped_refptr<net::X509Certificate> cert_; | 47 scoped_refptr<net::X509Certificate> cert_; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 109 |
114 // Make sure that interstitial is displayed. | 110 // Make sure that interstitial is displayed. |
115 EXPECT_TRUE(web_state()->IsShowingWebInterstitial()); | 111 EXPECT_TRUE(web_state()->IsShowingWebInterstitial()); |
116 web::WebInterstitial* interstitial = web_state()->GetWebInterstitial(); | 112 web::WebInterstitial* interstitial = web_state()->GetWebInterstitial(); |
117 EXPECT_TRUE(interstitial); | 113 EXPECT_TRUE(interstitial); |
118 | 114 |
119 // Make sure callback is called on dismissal. | 115 // Make sure callback is called on dismissal. |
120 interstitial->DontProceed(); | 116 interstitial->DontProceed(); |
121 EXPECT_TRUE(do_not_proceed_callback_called); | 117 EXPECT_TRUE(do_not_proceed_callback_called); |
122 } | 118 } |
OLD | NEW |