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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2231523002: Make ResourceFetcher return Resources with LoadError instead of nullptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment phrasing. Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 6874 matching lines...) Expand 10 before | Expand all | Expand 10 after
6885 { 6885 {
6886 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json"); 6886 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json");
6887 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'"); 6887 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'");
6888 6888
6889 FrameTestHelpers::WebViewHelper webViewHelper; 6889 FrameTestHelpers::WebViewHelper webViewHelper;
6890 webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); 6890 webViewHelper.initializeAndLoad(m_baseURL + "foo.html");
6891 Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->docu ment(); 6891 Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->docu ment();
6892 6892
6893 Resource* resource = fetchManifest(document, toKURL(m_notBaseURL + "link-man ifest-fetch.json")); 6893 Resource* resource = fetchManifest(document, toKURL(m_notBaseURL + "link-man ifest-fetch.json"));
6894 6894
6895 EXPECT_EQ(0, resource); // Fetching resource wasn't allowed. 6895 // Fetching resource wasn't allowed.
6896 ASSERT_TRUE(resource);
6897 EXPECT_TRUE(resource->errorOccurred());
6898 EXPECT_TRUE(resource->resourceError().isAccessCheck());
6896 } 6899 }
6897 6900
6898 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchSelfReportOnly) 6901 TEST_P(ParameterizedWebFrameTest, ManifestCSPFetchSelfReportOnly)
6899 { 6902 {
6900 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json"); 6903 URLTestHelpers::registerMockedURLLoad(toKURL(m_notBaseURL + "link-manifest-f etch.json"), "link-manifest-fetch.json");
6901 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'", /* repor t only */ true); 6904 registerMockedHttpURLLoadWithCSP("foo.html", "manifest-src 'self'", /* repor t only */ true);
6902 6905
6903 FrameTestHelpers::WebViewHelper webViewHelper; 6906 FrameTestHelpers::WebViewHelper webViewHelper;
6904 webViewHelper.initializeAndLoad(m_baseURL + "foo.html"); 6907 webViewHelper.initializeAndLoad(m_baseURL + "foo.html");
6905 Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->docu ment(); 6908 Document* document = webViewHelper.webView()->mainFrameImpl()->frame()->docu ment();
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after
8985 FrameTestHelpers::WebViewHelper helper; 8988 FrameTestHelpers::WebViewHelper helper;
8986 helper.initializeAndLoad(url, true); 8989 helper.initializeAndLoad(url, true);
8987 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); 8990 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr);
8988 8991
8989 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do cument(); 8992 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do cument();
8990 EXPECT_TRUE(document->isImageDocument()); 8993 EXPECT_TRUE(document->isImageDocument());
8991 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g etStatus()); 8994 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g etStatus());
8992 } 8995 }
8993 8996
8994 } // namespace blink 8997 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698