| OLD | NEW |
| 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 6008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6019 { | 6019 { |
| 6020 registerMockedHttpURLLoad("foo_with_image.html"); | 6020 registerMockedHttpURLLoad("foo_with_image.html"); |
| 6021 registerMockedHttpURLLoad("white-1x1.png"); | 6021 registerMockedHttpURLLoad("white-1x1.png"); |
| 6022 TestSameDocumentWithImageWebFrameClient client; | 6022 TestSameDocumentWithImageWebFrameClient client; |
| 6023 FrameTestHelpers::WebViewHelper webViewHelper; | 6023 FrameTestHelpers::WebViewHelper webViewHelper; |
| 6024 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl
ient, nullptr, nullptr, &configureLoadsImagesAutomatically); | 6024 webViewHelper.initializeAndLoad(m_baseURL + "foo_with_image.html", true, &cl
ient, nullptr, nullptr, &configureLoadsImagesAutomatically); |
| 6025 | 6025 |
| 6026 WebCache::clear(); | 6026 WebCache::clear(); |
| 6027 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "foo_with_image.html"); | 6027 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "foo_with_image.html"); |
| 6028 | 6028 |
| 6029 // 2 images are requested, and each triggers 2 willSendRequest() calls, | 6029 // 2 images are requested, and each triggers 1 willSendRequest() calls for |
| 6030 // once for preloading and once for the real request. | 6030 // the preload. The real requests are served from MemoryCache. |
| 6031 EXPECT_EQ(client.numOfImageRequests(), 4); | 6031 EXPECT_EQ(client.numOfImageRequests(), 2); |
| 6032 } | 6032 } |
| 6033 | 6033 |
| 6034 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) | 6034 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) |
| 6035 { | 6035 { |
| 6036 FrameTestHelpers::WebViewHelper webViewHelper; | 6036 FrameTestHelpers::WebViewHelper webViewHelper; |
| 6037 webViewHelper.initializeAndLoad("about:blank", true); | 6037 webViewHelper.initializeAndLoad("about:blank", true); |
| 6038 WebFrame* frame = webViewHelper.webView()->mainFrame(); | 6038 WebFrame* frame = webViewHelper.webView()->mainFrame(); |
| 6039 | 6039 |
| 6040 static const char bluePNG[] = "<img src=\"data:image/png;base64,iVBORw0KGgoA
AAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGElEQVQYV2NkYPj/n4EIwDiqEF8oUT94AFIQE/cCn90I
AAAAAElFTkSuQmCC\">"; | 6040 static const char bluePNG[] = "<img src=\"data:image/png;base64,iVBORw0KGgoA
AAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGElEQVQYV2NkYPj/n4EIwDiqEF8oUT94AFIQE/cCn90I
AAAAAElFTkSuQmCC\">"; |
| 6041 | 6041 |
| (...skipping 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8938 FrameTestHelpers::WebViewHelper helper; | 8938 FrameTestHelpers::WebViewHelper helper; |
| 8939 helper.initializeAndLoad(url, true); | 8939 helper.initializeAndLoad(url, true); |
| 8940 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); | 8940 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); |
| 8941 | 8941 |
| 8942 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do
cument(); | 8942 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do
cument(); |
| 8943 EXPECT_TRUE(document->isImageDocument()); | 8943 EXPECT_TRUE(document->isImageDocument()); |
| 8944 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g
etStatus()); | 8944 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g
etStatus()); |
| 8945 } | 8945 } |
| 8946 | 8946 |
| 8947 } // namespace blink | 8947 } // namespace blink |
| OLD | NEW |