Chromium Code Reviews| Index: content/renderer/render_view_browsertest.cc |
| diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc |
| index a1d362d4c7bab21be70679b83a985373395505eb..6026f55cb6f79c5d84d64ab8c8a17236493d9e78 100644 |
| --- a/content/renderer/render_view_browsertest.cc |
| +++ b/content/renderer/render_view_browsertest.cc |
| @@ -1971,7 +1971,7 @@ TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) { |
| EXPECT_LT(last_input_type, last_selection); |
| } |
| -class SuppressErrorPageTest : public RenderViewImplTest { |
| +class RendererErrorPageTest : public RenderViewImplTest { |
| public: |
| ContentRendererClient* CreateContentRendererClient() override { |
| return new TestContentRendererClient; |
| @@ -2002,6 +2002,11 @@ class SuppressErrorPageTest : public RenderViewImplTest { |
| if (error_html) |
| *error_html = "A suffusion of yellow."; |
| } |
| + |
| + bool HasErrorPage(int http_status_code, |
| + std::string* error_domain) override { |
| + return true; |
| + } |
| }; |
| }; |
| @@ -2012,7 +2017,7 @@ class SuppressErrorPageTest : public RenderViewImplTest { |
| #define MAYBE_Suppresses Suppresses |
| #endif |
| -TEST_F(SuppressErrorPageTest, MAYBE_Suppresses) { |
| +TEST_F(RendererErrorPageTest, MAYBE_Suppresses) { |
| WebURLError error; |
| error.domain = WebString::fromUTF8(net::kErrorDomain); |
| error.reason = net::ERR_FILE_NOT_FOUND; |
| @@ -2043,7 +2048,7 @@ TEST_F(SuppressErrorPageTest, MAYBE_Suppresses) { |
| #define MAYBE_DoesNotSuppress DoesNotSuppress |
| #endif |
| -TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { |
| +TEST_F(RendererErrorPageTest, MAYBE_DoesNotSuppress) { |
| WebURLError error; |
| error.domain = WebString::fromUTF8(net::kErrorDomain); |
| error.reason = net::ERR_FILE_NOT_FOUND; |
| @@ -2070,6 +2075,32 @@ TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { |
| base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
| } |
| +TEST_F(RendererErrorPageTest, HttpStatusCodeErrorWithEmptyBody) { |
| + blink::WebURLResponse response; |
| + response.initialize(); |
| + response.setHTTPStatusCode(503); |
| + WebLocalFrame* web_frame = GetMainFrame(); |
| + |
| + // Start a load that will reach provisional state synchronously, |
| + // but won't complete synchronously. |
| + CommonNavigationParams common_params; |
| + common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| + common_params.url = GURL("data:text/html,test data"); |
| + TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame()); |
| + main_frame->Navigate(common_params, StartNavigationParams(), |
| + RequestNavigationParams()); |
| + |
| + // Emulate a 4xx/5xx main resource response with an empty body. |
| + main_frame->didReceiveResponse(web_frame, 1, response); |
| + main_frame->didFinishDocumentLoad(web_frame, true); |
|
Charlie Reis
2015/07/13 20:42:43
Sanity check: This won't get flaky if the actual d
Nate Chapin
2015/07/13 21:15:26
It shouldn't. didFinishDocumentLoad() should synch
|
| + |
| + // The error page itself is loaded asynchronously. |
| + FrameLoadWaiter(main_frame).Wait(); |
| + const int kMaxOutputCharacters = 22; |
| + EXPECT_EQ("A suffusion of yellow.", |
| + base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
| +} |
| + |
| // Ensure the render view sends favicon url update events correctly. |
| TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) { |
| // An event should be sent when a favicon url exists. |