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

Side by Side Diff: ios/web/web_state/ui/crw_web_controller_unittest.mm

Issue 2802163002: Removed CRWWebControllerInvalidUrlTest.LoadInvalidURL. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 web::NavigationItem* item = nav_manager->GetLastCommittedItem(); 572 web::NavigationItem* item = nav_manager->GetLastCommittedItem();
573 EXPECT_EQ(web::SECURITY_STYLE_UNAUTHENTICATED, item->GetSSL().security_style); 573 EXPECT_EQ(web::SECURITY_STYLE_UNAUTHENTICATED, item->GetSSL().security_style);
574 ASSERT_TRUE(observer.did_change_visible_security_state_info()); 574 ASSERT_TRUE(observer.did_change_visible_security_state_info());
575 EXPECT_EQ(web_state(), 575 EXPECT_EQ(web_state(),
576 observer.did_change_visible_security_state_info()->web_state); 576 observer.did_change_visible_security_state_info()->web_state);
577 } 577 }
578 578
579 // Real WKWebView is required for CRWWebControllerInvalidUrlTest. 579 // Real WKWebView is required for CRWWebControllerInvalidUrlTest.
580 typedef web::WebTestWithWebState CRWWebControllerInvalidUrlTest; 580 typedef web::WebTestWithWebState CRWWebControllerInvalidUrlTest;
581 581
582 // Tests that web controller navigates to about:blank if invalid URL is loaded.
583 TEST_F(CRWWebControllerInvalidUrlTest, LoadInvalidURL) {
584 GURL url(kInvalidURL);
585 ASSERT_FALSE(url.is_valid());
586 LoadHtml(@"<html><body></body></html>", url);
587 EXPECT_EQ(GURL(url::kAboutBlankURL), web_state()->GetLastCommittedURL());
588 }
589
590 // Tests that web controller does not navigate to about:blank if iframe src 582 // Tests that web controller does not navigate to about:blank if iframe src
591 // has invalid url. Web controller loads about:blank if page navigates to 583 // has invalid url. Web controller loads about:blank if page navigates to
592 // invalid url, but should do nothing if navigation is performed in iframe. This 584 // invalid url, but should do nothing if navigation is performed in iframe. This
593 // test prevents crbug.com/694865 regression. 585 // test prevents crbug.com/694865 regression.
594 TEST_F(CRWWebControllerInvalidUrlTest, IFrameWithInvalidURL) { 586 TEST_F(CRWWebControllerInvalidUrlTest, IFrameWithInvalidURL) {
595 GURL url("http://chromium.test"); 587 GURL url("http://chromium.test");
596 ASSERT_FALSE(GURL(kInvalidURL).is_valid()); 588 ASSERT_FALSE(GURL(kInvalidURL).is_valid());
597 LoadHtml([NSString stringWithFormat:@"<iframe src='%s'/>", kInvalidURL], url); 589 LoadHtml([NSString stringWithFormat:@"<iframe src='%s'/>", kInvalidURL], url);
598 EXPECT_EQ(url, web_state()->GetLastCommittedURL()); 590 EXPECT_EQ(url, web_state()->GetLastCommittedURL());
599 } 591 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 web::TestWebStateObserver* observer_ptr = &observer; 957 web::TestWebStateObserver* observer_ptr = &observer;
966 web::SimulateWKWebViewCrash(webView_); 958 web::SimulateWKWebViewCrash(webView_);
967 base::test::ios::WaitUntilCondition(^bool() { 959 base::test::ios::WaitUntilCondition(^bool() {
968 return observer_ptr->render_process_gone_info(); 960 return observer_ptr->render_process_gone_info();
969 }); 961 });
970 EXPECT_EQ(web_state(), observer.render_process_gone_info()->web_state); 962 EXPECT_EQ(web_state(), observer.render_process_gone_info()->web_state);
971 EXPECT_FALSE([web_controller() isViewAlive]); 963 EXPECT_FALSE([web_controller() isViewAlive]);
972 }; 964 };
973 965
974 } // namespace 966 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698