| 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/net/crw_ssl_status_updater.h" | 5 #import "ios/web/net/crw_ssl_status_updater.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/scoped_block.h" | 8 #include "base/mac/scoped_block.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "ios/web/navigation/crw_session_controller+private_constructors.h" | 10 #import "ios/web/navigation/crw_session_controller+private_constructors.h" |
| 11 #import "ios/web/navigation/crw_session_controller.h" | 11 #import "ios/web/navigation/crw_session_controller.h" |
| 12 #import "ios/web/navigation/legacy_navigation_manager_impl.h" |
| 12 #import "ios/web/navigation/navigation_manager_impl.h" | 13 #import "ios/web/navigation/navigation_manager_impl.h" |
| 13 #import "ios/web/public/navigation_item.h" | 14 #import "ios/web/public/navigation_item.h" |
| 14 #include "ios/web/public/ssl_status.h" | 15 #include "ios/web/public/ssl_status.h" |
| 15 #include "ios/web/public/test/web_test.h" | 16 #include "ios/web/public/test/web_test.h" |
| 16 #import "ios/web/web_state/wk_web_view_security_util.h" | 17 #import "ios/web/web_state/wk_web_view_security_util.h" |
| 17 #include "net/cert/x509_util_ios_and_mac.h" | 18 #include "net/cert/x509_util_ios_and_mac.h" |
| 18 #include "net/test/cert_test_util.h" | 19 #include "net/test/cert_test_util.h" |
| 19 #include "net/test/test_data_directory.h" | 20 #include "net/test/test_data_directory.h" |
| 20 #include "third_party/ocmock/OCMock/OCMock.h" | 21 #include "third_party/ocmock/OCMock/OCMock.h" |
| 21 #include "third_party/ocmock/gtest_support.h" | 22 #include "third_party/ocmock/gtest_support.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Test fixture to test CRWSSLStatusUpdater class. | 80 // Test fixture to test CRWSSLStatusUpdater class. |
| 80 class CRWSSLStatusUpdaterTest : public web::WebTest { | 81 class CRWSSLStatusUpdaterTest : public web::WebTest { |
| 81 protected: | 82 protected: |
| 82 void SetUp() override { | 83 void SetUp() override { |
| 83 web::WebTest::SetUp(); | 84 web::WebTest::SetUp(); |
| 84 | 85 |
| 85 data_source_ = [[CRWSSLStatusUpdaterTestDataSource alloc] init]; | 86 data_source_ = [[CRWSSLStatusUpdaterTestDataSource alloc] init]; |
| 86 delegate_ = | 87 delegate_ = |
| 87 [OCMockObject mockForProtocol:@protocol(CRWSSLStatusUpdaterDelegate)]; | 88 [OCMockObject mockForProtocol:@protocol(CRWSSLStatusUpdaterDelegate)]; |
| 88 | 89 |
| 89 nav_manager_.reset(new NavigationManagerImpl()); | 90 nav_manager_.reset(new LegacyNavigationManagerImpl()); |
| 90 nav_manager_->SetBrowserState(GetBrowserState()); | 91 nav_manager_->SetBrowserState(GetBrowserState()); |
| 91 | 92 |
| 92 ssl_status_updater_ = | 93 ssl_status_updater_ = |
| 93 [[CRWSSLStatusUpdater alloc] initWithDataSource:data_source_ | 94 [[CRWSSLStatusUpdater alloc] initWithDataSource:data_source_ |
| 94 navigationManager:nav_manager_.get()]; | 95 navigationManager:nav_manager_.get()]; |
| 95 [ssl_status_updater_ setDelegate:delegate_]; | 96 [ssl_status_updater_ setDelegate:delegate_]; |
| 96 | 97 |
| 97 // Create test cert chain. | 98 // Create test cert chain. |
| 98 scoped_refptr<net::X509Certificate> cert = | 99 scoped_refptr<net::X509Certificate> cert = |
| 99 net::ImportCertFromFile(net::GetTestCertsDirectory(), kCertFileName); | 100 net::ImportCertFromFile(net::GetTestCertsDirectory(), kCertFileName); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 [data_source_ | 370 [data_source_ |
| 370 finishVerificationWithCertStatus:0 | 371 finishVerificationWithCertStatus:0 |
| 371 securityStyle:web::SECURITY_STYLE_AUTHENTICATED]; | 372 securityStyle:web::SECURITY_STYLE_AUTHENTICATED]; |
| 372 | 373 |
| 373 // Make sure that security style and content status did change. | 374 // Make sure that security style and content status did change. |
| 374 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); | 375 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); |
| 375 EXPECT_EQ(web::SSLStatus::NORMAL_CONTENT, item->GetSSL().content_status); | 376 EXPECT_EQ(web::SSLStatus::NORMAL_CONTENT, item->GetSSL().content_status); |
| 376 } | 377 } |
| 377 | 378 |
| 378 } // namespace web | 379 } // namespace web |
| OLD | NEW |