Commit 4cd13b43 authored by Mike Dougherty's avatar Mike Dougherty Committed by Commit Bot

Fix invalid NSError initializations.

Initialize NSError with the designated initializer to prevent the
following message from being printing to the console.

    -[NSError init] called; this results in an invalid NSError instance.
    It will raise an exception in a future release. Please call
    errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:.
    This message shown only once.

Bug: None
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I94ac7664f7254126a5e2095d7c22c76497615c04
Reviewed-on: https://chromium-review.googlesource.com/1110490Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569429}
parent c252bd93
......@@ -160,7 +160,7 @@ TEST_F(NavigationContextImplTest, Setters) {
EXPECT_EQ(WKNavigationTypeOther, context->GetWKNavigationType());
// SetErrorPage
NSError* error = [[NSError alloc] init];
NSError* error = [[NSError alloc] initWithDomain:@"" code:0 userInfo:nil];
context->SetError(error);
EXPECT_EQ(new_url, context->GetUrl());
EXPECT_TRUE(context->IsSameDocument());
......
......@@ -122,7 +122,7 @@ TEST_F(CRWWKNavigationStatesTest, Context) {
nullptr /*web_state*/, GURL(kTestUrl2), /*has_user_gesture=*/false,
ui::PageTransition::PAGE_TRANSITION_GENERATED,
/*is_renderer_initiated=*/true);
NSError* error = [[NSError alloc] init];
NSError* error = [[NSError alloc] initWithDomain:@"" code:0 userInfo:nil];
context2->SetError(error);
[states_ setContext:std::move(context2) forNavigation:navigation1_];
EXPECT_FALSE([states_ contextForNavigation:navigation2_]);
......
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