Commit c3c4b666 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Add test for bad SSL from NTP

This CL adds a test to make sure we don't display the NTP if the loaded
page is an interstitial page.

Fixed: 1067250
Change-Id: If0b28650148acee4f1379028826ca1cc603834f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2151451
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759591}
parent d7623af8
...@@ -369,6 +369,7 @@ source_set("eg_tests") { ...@@ -369,6 +369,7 @@ source_set("eg_tests") {
"progress_indicator_egtest.mm", "progress_indicator_egtest.mm",
"push_and_replace_state_navigation_egtest.mm", "push_and_replace_state_navigation_egtest.mm",
"restore_egtest.mm", "restore_egtest.mm",
"ssl_egtest.mm",
"stop_loading_egtest.mm", "stop_loading_egtest.mm",
"tab_order_egtest.mm", "tab_order_egtest.mm",
"visible_url_egtest.mm", "visible_url_egtest.mm",
...@@ -472,6 +473,7 @@ source_set("eg2_tests") { ...@@ -472,6 +473,7 @@ source_set("eg2_tests") {
"progress_indicator_egtest.mm", "progress_indicator_egtest.mm",
"push_and_replace_state_navigation_egtest.mm", "push_and_replace_state_navigation_egtest.mm",
"restore_egtest.mm", "restore_egtest.mm",
"ssl_egtest.mm",
"stop_loading_egtest.mm", "stop_loading_egtest.mm",
"tab_order_egtest.mm", "tab_order_egtest.mm",
"visible_url_egtest.mm", "visible_url_egtest.mm",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/bind.h"
#include "components/strings/grit/components_strings.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "ios/testing/embedded_test_server_handlers.h"
#include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/embedded_test_server/request_handler_util.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface SSLTestCase : ChromeTestCase {
std::unique_ptr<net::test_server::EmbeddedTestServer> _HTTPSServer;
}
@end
@implementation SSLTestCase
- (void)setUp {
[super setUp];
_HTTPSServer = std::make_unique<net::test_server::EmbeddedTestServer>(
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
RegisterDefaultHandlers(_HTTPSServer.get());
}
// Test loading a page with a bad SSL certificate from the NTP, to avoid
// https://crbug.com/1067250 from regressing.
- (void)testBadSSLOnNTP {
GREYAssertTrue(_HTTPSServer->Start(), @"Test server failed to start.");
const GURL pageURL = _HTTPSServer->GetURL("/echo");
[ChromeEarlGrey loadURL:pageURL];
[ChromeEarlGrey waitForWebStateContainingText:l10n_util::GetStringUTF8(
IDS_SSL_V2_HEADING)];
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment