Commit e940ea33 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Add web::testing::CreateTestNetError for testing error pages.

This replaces the usage of private web API in the test.

Bug=622485

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I848dad4fddf60bc7a5e83f5008b151f143b1f7a7
Reviewed-on: https://chromium-review.googlesource.com/1014417
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551727}
parent 290d112f
specific_include_rules = {
# TODO(crbug.com/622485): Remove this exception.
"^error_page_generator_unittest\.mm$": [
"+ios/web/web_state/error_translation_util.h",
],
}
......@@ -4,8 +4,8 @@
#import "ios/chrome/browser/web/error_page_generator.h"
#include "base/strings/sys_string_conversions.h"
#import "ios/web/public/test/error_test_util.h"
#include "ios/web/public/test/web_test.h"
#include "ios/web/web_state/error_translation_util.h"
#import "net/base/mac/url_conversions.h"
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -47,7 +47,7 @@ class ErrorPageGeneratorTest : public web::WebTest {
NSURLErrorFailingURLStringErrorKey :
base::SysUTF8ToNSString(errorURL.spec())
};
return web::NetErrorFromError(
return web::testing::CreateTestNetError(
[NSError errorWithDomain:errorDomain code:errorCode userInfo:info]);
}
......
......@@ -27,6 +27,8 @@ source_set("test") {
allow_circular_includes_from = [ "//ios/web/test:test_support" ]
sources = [
"error_test_util.h",
"error_test_util.mm",
"js_test_util.h",
"js_test_util.mm",
"native_controller_test_util.h",
......
// Copyright 2018 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.
#ifndef IOS_WEB_PUBLIC_TEST_ERROR_TEST_UTIL_H_
#define IOS_WEB_PUBLIC_TEST_ERROR_TEST_UTIL_H_
@class NSError;
namespace web {
namespace testing {
// Creates Chrome specific error from a regular NSError. Returned error has the
// same format and structure as errors provided in ios/web callbacks.
NSError* CreateTestNetError(NSError* error);
} // namespace testing
} // namespace web
#endif // IOS_WEB_PUBLIC_TEST_ERROR_TEST_UTIL_H_
// Copyright 2018 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.
#import "ios/web/public/test/error_test_util.h"
#import "ios/web/web_state/error_translation_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace web {
namespace testing {
NSError* CreateTestNetError(NSError* error) {
return NetErrorFromError(error);
}
} // namespace testing
} // namespace web
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