Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Side by Side Diff: ios/web/net/crw_ssl_status_updater_unittest.mm

Issue 2151693008: [ios] Use -[WKWebView serverTrust] instead of certificateChain on iOS 10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/net/crw_ssl_status_updater.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/scoped_block.h" 7 #include "base/mac/scoped_block.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "ios/web/navigation/crw_session_controller+private_constructors.h" 9 #import "ios/web/navigation/crw_session_controller+private_constructors.h"
10 #import "ios/web/navigation/crw_session_controller.h" 10 #import "ios/web/navigation/crw_session_controller.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 - (void)finishVerificationWithCertStatus:(net::CertStatus)certStatus 45 - (void)finishVerificationWithCertStatus:(net::CertStatus)certStatus
46 securityStyle:(web::SecurityStyle)securityStyle { 46 securityStyle:(web::SecurityStyle)securityStyle {
47 _verificationCompletionHandler.get()(securityStyle, certStatus); 47 _verificationCompletionHandler.get()(securityStyle, certStatus);
48 } 48 }
49 49
50 #pragma mark CRWSSLStatusUpdaterDataSource 50 #pragma mark CRWSSLStatusUpdaterDataSource
51 51
52 - (void)SSLStatusUpdater:(CRWSSLStatusUpdater*)SSLStatusUpdater 52 - (void)SSLStatusUpdater:(CRWSSLStatusUpdater*)SSLStatusUpdater
53 querySSLStatusForCertChain:(NSArray*)chain 53 querySSLStatusForTrust:(base::ScopedCFTypeRef<SecTrustRef>)trust
54 host:(NSString*)host 54 host:(NSString*)host
55 completionHandler:(StatusQueryHandler)completionHandler { 55 completionHandler:(StatusQueryHandler)completionHandler {
56 _verificationCompletionHandler.reset([completionHandler copy]); 56 _verificationCompletionHandler.reset([completionHandler copy]);
57 } 57 }
58 58
59 @end 59 @end
60 60
61 namespace web { 61 namespace web {
62 62
63 namespace { 63 namespace {
64 // Generated cert filename. 64 // Generated cert filename.
65 const char kCertFileName[] = "ok_cert.pem"; 65 const char kCertFileName[] = "ok_cert.pem";
(...skipping 22 matching lines...) Expand all
88 ssl_status_updater_.reset([[CRWSSLStatusUpdater alloc] 88 ssl_status_updater_.reset([[CRWSSLStatusUpdater alloc]
89 initWithDataSource:data_source_ 89 initWithDataSource:data_source_
90 navigationManager:nav_manager_.get() 90 navigationManager:nav_manager_.get()
91 certGroupID:kCertGroupID]); 91 certGroupID:kCertGroupID]);
92 [ssl_status_updater_ setDelegate:delegate_]; 92 [ssl_status_updater_ setDelegate:delegate_];
93 93
94 // Create test cert chain. 94 // Create test cert chain.
95 scoped_refptr<net::X509Certificate> cert = 95 scoped_refptr<net::X509Certificate> cert =
96 net::ImportCertFromFile(net::GetTestCertsDirectory(), kCertFileName); 96 net::ImportCertFromFile(net::GetTestCertsDirectory(), kCertFileName);
97 ASSERT_TRUE(cert); 97 ASSERT_TRUE(cert);
98 cert_chain_.reset([@[ static_cast<id>(cert->os_cert_handle()) ] retain]); 98 NSArray* chain = @[ static_cast<id>(cert->os_cert_handle()) ];
99 trust_ = CreateServerTrustFromChain(chain, kHostName);
99 } 100 }
100 101
101 void TearDown() override { 102 void TearDown() override {
102 EXPECT_OCMOCK_VERIFY(delegate_); 103 EXPECT_OCMOCK_VERIFY(delegate_);
103 web::WebTest::TearDown(); 104 web::WebTest::TearDown();
104 } 105 }
105 106
106 // Returns autoreleased session controller with a single committed entry. 107 // Returns autoreleased session controller with a single committed entry.
107 CRWSessionController* SessionControllerWithEntry(std::string item_url_spec) { 108 CRWSessionController* SessionControllerWithEntry(std::string item_url_spec) {
108 ScopedVector<web::NavigationItem> nav_items; 109 ScopedVector<web::NavigationItem> nav_items;
109 base::scoped_nsobject<CRWSessionController> session_controller( 110 base::scoped_nsobject<CRWSessionController> session_controller(
110 [[CRWSessionController alloc] 111 [[CRWSessionController alloc]
111 initWithNavigationItems:std::move(nav_items) 112 initWithNavigationItems:std::move(nav_items)
112 currentIndex:0 113 currentIndex:0
113 browserState:GetBrowserState()]); 114 browserState:GetBrowserState()]);
114 [session_controller addPendingEntry:GURL(item_url_spec) 115 [session_controller addPendingEntry:GURL(item_url_spec)
115 referrer:Referrer() 116 referrer:Referrer()
116 transition:ui::PAGE_TRANSITION_LINK 117 transition:ui::PAGE_TRANSITION_LINK
117 rendererInitiated:NO]; 118 rendererInitiated:NO];
118 [session_controller commitPendingEntry]; 119 [session_controller commitPendingEntry];
119 120
120 return session_controller.autorelease(); 121 return session_controller.autorelease();
121 } 122 }
122 123
123 base::scoped_nsobject<CRWSSLStatusUpdaterTestDataSource> data_source_; 124 base::scoped_nsobject<CRWSSLStatusUpdaterTestDataSource> data_source_;
124 base::scoped_nsprotocol<id> delegate_; 125 base::scoped_nsprotocol<id> delegate_;
125 std::unique_ptr<web::NavigationManagerImpl> nav_manager_; 126 std::unique_ptr<web::NavigationManagerImpl> nav_manager_;
126 base::scoped_nsobject<CRWSSLStatusUpdater> ssl_status_updater_; 127 base::scoped_nsobject<CRWSSLStatusUpdater> ssl_status_updater_;
127 base::scoped_nsobject<NSArray> cert_chain_; 128 base::ScopedCFTypeRef<SecTrustRef> trust_;
128 }; 129 };
129 130
130 // Tests that CRWSSLStatusUpdater init returns non nil object. 131 // Tests that CRWSSLStatusUpdater init returns non nil object.
131 TEST_F(CRWSSLStatusUpdaterTest, Initialization) { 132 TEST_F(CRWSSLStatusUpdaterTest, Initialization) {
132 EXPECT_TRUE(ssl_status_updater_); 133 EXPECT_TRUE(ssl_status_updater_);
133 } 134 }
134 135
135 // Tests updating http navigation item. 136 // Tests updating http navigation item.
136 TEST_F(CRWSSLStatusUpdaterTest, HttpItem) { 137 TEST_F(CRWSSLStatusUpdaterTest, HttpItem) {
137 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpUrl)); 138 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpUrl));
138 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 139 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
139 // Make sure that item change callback was called. 140 // Make sure that item change callback was called.
140 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 141 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
141 didChangeSSLStatusForNavigationItem:item]; 142 didChangeSSLStatusForNavigationItem:item];
142 143
143 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 144 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
144 withCertHost:kHostName 145 withCertHost:kHostName
145 certChain:cert_chain_ 146 trust:trust_
146 hasOnlySecureContent:NO]; 147 hasOnlySecureContent:NO];
147 148
148 // No certificate for http. 149 // No certificate for http.
149 EXPECT_FALSE(item->GetSSL().cert_id); 150 EXPECT_FALSE(item->GetSSL().cert_id);
150 // Make sure that security style and content status did change. 151 // Make sure that security style and content status did change.
151 EXPECT_EQ(web::SECURITY_STYLE_UNAUTHENTICATED, item->GetSSL().security_style); 152 EXPECT_EQ(web::SECURITY_STYLE_UNAUTHENTICATED, item->GetSSL().security_style);
152 EXPECT_EQ(web::SSLStatus::DISPLAYED_INSECURE_CONTENT, 153 EXPECT_EQ(web::SSLStatus::DISPLAYED_INSECURE_CONTENT,
153 item->GetSSL().content_status); 154 item->GetSSL().content_status);
154 } 155 }
155 156
156 // Tests that delegate callback is not called if no changes were made to http 157 // Tests that delegate callback is not called if no changes were made to http
157 // navigation item. 158 // navigation item.
158 TEST_F(CRWSSLStatusUpdaterTest, NoChangesToHttpItem) { 159 TEST_F(CRWSSLStatusUpdaterTest, NoChangesToHttpItem) {
159 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpUrl)); 160 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpUrl));
160 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 161 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
161 item->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED; 162 item->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED;
162 163
163 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 164 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
164 withCertHost:kHostName 165 withCertHost:kHostName
165 certChain:cert_chain_ 166 trust:trust_
166 hasOnlySecureContent:YES]; 167 hasOnlySecureContent:YES];
167 // No certificate for http. 168 // No certificate for http.
168 EXPECT_FALSE(item->GetSSL().cert_id); 169 EXPECT_FALSE(item->GetSSL().cert_id);
169 // Make sure that security style did not change. 170 // Make sure that security style did not change.
170 EXPECT_EQ(web::SECURITY_STYLE_UNAUTHENTICATED, item->GetSSL().security_style); 171 EXPECT_EQ(web::SECURITY_STYLE_UNAUTHENTICATED, item->GetSSL().security_style);
171 } 172 }
172 173
173 // Tests updating https navigation item without cert. 174 // Tests updating https navigation item without cert.
174 TEST_F(CRWSSLStatusUpdaterTest, HttpsItemNoCert) { 175 TEST_F(CRWSSLStatusUpdaterTest, HttpsItemNoCert) {
175 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl)); 176 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl));
176 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 177 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
177 // Change default value to test that |item| is actually changed. 178 // Change default value to test that |item| is actually changed.
178 item->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED; 179 item->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED;
179 180
180 // Make sure that item change callback was called. 181 // Make sure that item change callback was called.
181 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 182 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
182 didChangeSSLStatusForNavigationItem:item]; 183 didChangeSSLStatusForNavigationItem:item];
183 184
184 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 185 [ssl_status_updater_
185 withCertHost:kHostName 186 updateSSLStatusForNavigationItem:item
186 certChain:@[] 187 withCertHost:kHostName
187 hasOnlySecureContent:YES]; 188 trust:base::ScopedCFTypeRef<SecTrustRef>()
189 hasOnlySecureContent:YES];
188 // No certificate. 190 // No certificate.
189 EXPECT_FALSE(item->GetSSL().cert_id); 191 EXPECT_FALSE(item->GetSSL().cert_id);
190 // Make sure that security style did change. 192 // Make sure that security style did change.
191 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 193 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
192 EXPECT_EQ(web::SSLStatus::NORMAL_CONTENT, item->GetSSL().content_status); 194 EXPECT_EQ(web::SSLStatus::NORMAL_CONTENT, item->GetSSL().content_status);
193 } 195 }
194 196
195 // Tests that unnecessary cert verification does not happen if SSL status has 197 // Tests that unnecessary cert verification does not happen if SSL status has
196 // already been calculated and the only change was appearing of mixed content. 198 // already been calculated and the only change was appearing of mixed content.
197 TEST_F(CRWSSLStatusUpdaterTest, HttpsItemNoCertReverification) { 199 TEST_F(CRWSSLStatusUpdaterTest, HttpsItemNoCertReverification) {
198 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl)); 200 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl));
199 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 201 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
200 // Set SSL status manually in the way so cert re-verification is not run. 202 // Set SSL status manually in the way so cert re-verification is not run.
201 item->GetSSL().cert_status_host = base::SysNSStringToUTF8(kHostName); 203 item->GetSSL().cert_status_host = base::SysNSStringToUTF8(kHostName);
202 item->GetSSL().cert_id = web::CertStore::GetInstance()->StoreCert( 204 item->GetSSL().cert_id = web::CertStore::GetInstance()->StoreCert(
203 web::CreateCertFromChain(cert_chain_).get(), kCertGroupID); 205 web::CreateCertFromTrust(trust_).get(), kCertGroupID);
204 206
205 // Make sure that item change callback was called. 207 // Make sure that item change callback was called.
206 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 208 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
207 didChangeSSLStatusForNavigationItem:item]; 209 didChangeSSLStatusForNavigationItem:item];
208 210
209 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 211 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
210 withCertHost:kHostName 212 withCertHost:kHostName
211 certChain:cert_chain_ 213 trust:trust_
212 hasOnlySecureContent:NO]; 214 hasOnlySecureContent:NO];
213 // Make sure that cert verification did not run. 215 // Make sure that cert verification did not run.
214 EXPECT_FALSE([data_source_ certVerificationRequested]); 216 EXPECT_FALSE([data_source_ certVerificationRequested]);
215 217
216 // Make sure that security style and content status did change. 218 // Make sure that security style and content status did change.
217 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 219 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
218 EXPECT_EQ(web::SSLStatus::DISPLAYED_INSECURE_CONTENT, 220 EXPECT_EQ(web::SSLStatus::DISPLAYED_INSECURE_CONTENT,
219 item->GetSSL().content_status); 221 item->GetSSL().content_status);
220 } 222 }
221 223
222 // Tests updating https navigation item. 224 // Tests updating https navigation item.
223 TEST_F(CRWSSLStatusUpdaterTest, HttpsItem) { 225 TEST_F(CRWSSLStatusUpdaterTest, HttpsItem) {
224 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl)); 226 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl));
225 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 227 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
226 228
227 // Make sure that item change callback was called twice for changing 229 // Make sure that item change callback was called twice for changing
228 // content_status and security style. 230 // content_status and security style.
229 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 231 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
230 didChangeSSLStatusForNavigationItem:item]; 232 didChangeSSLStatusForNavigationItem:item];
231 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 233 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
232 didChangeSSLStatusForNavigationItem:item]; 234 didChangeSSLStatusForNavigationItem:item];
233 235
234 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 236 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
235 withCertHost:kHostName 237 withCertHost:kHostName
236 certChain:cert_chain_ 238 trust:trust_
237 hasOnlySecureContent:NO]; 239 hasOnlySecureContent:NO];
238 240
239 // Make sure that cert verification was requested. 241 // Make sure that cert verification was requested.
240 EXPECT_TRUE([data_source_ certVerificationRequested]); 242 EXPECT_TRUE([data_source_ certVerificationRequested]);
241 243
242 // Make sure that security style and cert status are reset during 244 // Make sure that security style and cert status are reset during
243 // verification. 245 // verification.
244 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 246 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
245 EXPECT_FALSE(item->GetSSL().cert_status); 247 EXPECT_FALSE(item->GetSSL().cert_status);
246 248
(...skipping 16 matching lines...) Expand all
263 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl)); 265 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl));
264 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 266 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
265 267
266 // Make sure that item change callback was called once for changing 268 // Make sure that item change callback was called once for changing
267 // content_status. 269 // content_status.
268 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 270 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
269 didChangeSSLStatusForNavigationItem:item]; 271 didChangeSSLStatusForNavigationItem:item];
270 272
271 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 273 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
272 withCertHost:kHostName 274 withCertHost:kHostName
273 certChain:cert_chain_ 275 trust:trust_
274 hasOnlySecureContent:YES]; 276 hasOnlySecureContent:YES];
275 277
276 // Make sure that cert verification was requested. 278 // Make sure that cert verification was requested.
277 EXPECT_TRUE([data_source_ certVerificationRequested]); 279 EXPECT_TRUE([data_source_ certVerificationRequested]);
278 280
279 // Make sure that security style and cert status are reset during 281 // Make sure that security style and cert status are reset during
280 // verification. 282 // verification.
281 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 283 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
282 EXPECT_FALSE(item->GetSSL().cert_status); 284 EXPECT_FALSE(item->GetSSL().cert_status);
283 285
(...skipping 15 matching lines...) Expand all
299 TEST_F(CRWSSLStatusUpdaterTest, HttpsItemDowngrade) { 301 TEST_F(CRWSSLStatusUpdaterTest, HttpsItemDowngrade) {
300 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl)); 302 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl));
301 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 303 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
302 304
303 // Make sure that item change callback was called. 305 // Make sure that item change callback was called.
304 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 306 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
305 didChangeSSLStatusForNavigationItem:item]; 307 didChangeSSLStatusForNavigationItem:item];
306 308
307 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 309 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
308 withCertHost:kHostName 310 withCertHost:kHostName
309 certChain:cert_chain_ 311 trust:trust_
310 hasOnlySecureContent:YES]; 312 hasOnlySecureContent:YES];
311 313
312 // Make sure that cert verification was requested. 314 // Make sure that cert verification was requested.
313 EXPECT_TRUE([data_source_ certVerificationRequested]); 315 EXPECT_TRUE([data_source_ certVerificationRequested]);
314 316
315 // Make sure that security style and cert status are reset during 317 // Make sure that security style and cert status are reset during
316 // verification. 318 // verification.
317 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 319 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
318 EXPECT_FALSE(item->GetSSL().cert_status); 320 EXPECT_FALSE(item->GetSSL().cert_status);
319 321
(...skipping 14 matching lines...) Expand all
334 TEST_F(CRWSSLStatusUpdaterTest, CertChanged) { 336 TEST_F(CRWSSLStatusUpdaterTest, CertChanged) {
335 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl)); 337 nav_manager_->SetSessionController(SessionControllerWithEntry(kHttpsUrl));
336 web::NavigationItem* item = nav_manager_->GetLastCommittedItem(); 338 web::NavigationItem* item = nav_manager_->GetLastCommittedItem();
337 339
338 // Make sure that item change callback was called. 340 // Make sure that item change callback was called.
339 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_ 341 [[delegate_ expect] SSLStatusUpdater:ssl_status_updater_
340 didChangeSSLStatusForNavigationItem:item]; 342 didChangeSSLStatusForNavigationItem:item];
341 343
342 [ssl_status_updater_ updateSSLStatusForNavigationItem:item 344 [ssl_status_updater_ updateSSLStatusForNavigationItem:item
343 withCertHost:kHostName 345 withCertHost:kHostName
344 certChain:cert_chain_ 346 trust:trust_
345 hasOnlySecureContent:YES]; 347 hasOnlySecureContent:YES];
346 348
347 // Make sure that cert verification was requested. 349 // Make sure that cert verification was requested.
348 EXPECT_TRUE([data_source_ certVerificationRequested]); 350 EXPECT_TRUE([data_source_ certVerificationRequested]);
349 351
350 // Make sure that security style and cert status are reset during 352 // Make sure that security style and cert status are reset during
351 // verification. 353 // verification.
352 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 354 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
353 EXPECT_FALSE(item->GetSSL().cert_status); 355 EXPECT_FALSE(item->GetSSL().cert_status);
354 356
355 // Change the cert. 357 // Change the cert.
356 item->GetSSL().cert_id = -1; 358 item->GetSSL().cert_id = -1;
357 359
358 // Reply with calculated cert verification status. 360 // Reply with calculated cert verification status.
359 [data_source_ 361 [data_source_
360 finishVerificationWithCertStatus:0 362 finishVerificationWithCertStatus:0
361 securityStyle:web::SECURITY_STYLE_AUTHENTICATED]; 363 securityStyle:web::SECURITY_STYLE_AUTHENTICATED];
362 364
363 // Make sure that security style and content status did change. 365 // Make sure that security style and content status did change.
364 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style); 366 EXPECT_EQ(web::SECURITY_STYLE_UNKNOWN, item->GetSSL().security_style);
365 EXPECT_EQ(web::SSLStatus::NORMAL_CONTENT, item->GetSSL().content_status); 367 EXPECT_EQ(web::SSLStatus::NORMAL_CONTENT, item->GetSSL().content_status);
366 } 368 }
367 369
368 } // namespace web 370 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/net/crw_ssl_status_updater.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698