| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "core/frame/FrameSerializer.h" | 31 #include "core/frame/FrameSerializer.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/V8Binding.h" | 33 #include "bindings/core/v8/V8Binding.h" |
| 34 #include "bindings/core/v8/V8BindingForTesting.h" | 34 #include "bindings/core/v8/V8BindingForTesting.h" |
| 35 #include "platform/SerializedResource.h" | 35 #include "platform/SerializedResource.h" |
| 36 #include "platform/testing/URLTestHelpers.h" | 36 #include "platform/testing/URLTestHelpers.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebString.h" | 38 #include "public/platform/WebString.h" |
| 39 #include "public/platform/WebThread.h" | 39 #include "public/platform/WebThread.h" |
| 40 #include "public/platform/WebURL.h" | 40 #include "public/platform/WebURL.h" |
| 41 #include "public/platform/WebURLLoaderMockFactory.h" |
| 41 #include "public/platform/WebURLRequest.h" | 42 #include "public/platform/WebURLRequest.h" |
| 42 #include "public/platform/WebURLResponse.h" | 43 #include "public/platform/WebURLResponse.h" |
| 43 #include "public/platform/WebUnitTestSupport.h" | 44 #include "public/web/WebCache.h" |
| 44 #include "public/web/WebSettings.h" | 45 #include "public/web/WebSettings.h" |
| 45 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 46 #include "web/WebLocalFrameImpl.h" | 47 #include "web/WebLocalFrameImpl.h" |
| 47 #include "web/WebViewImpl.h" | 48 #include "web/WebViewImpl.h" |
| 48 #include "web/tests/FrameTestHelpers.h" | 49 #include "web/tests/FrameTestHelpers.h" |
| 49 #include "wtf/Assertions.h" | 50 #include "wtf/Assertions.h" |
| 50 #include "wtf/Vector.h" | 51 #include "wtf/Vector.h" |
| 51 | 52 |
| 52 using blink::URLTestHelpers::toKURL; | 53 using blink::URLTestHelpers::toKURL; |
| 53 using blink::URLTestHelpers::registerMockedURLLoad; | 54 using blink::URLTestHelpers::registerMockedURLLoad; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 protected: | 68 protected: |
| 68 void SetUp() override | 69 void SetUp() override |
| 69 { | 70 { |
| 70 // We want the images to load and JavaScript to be on. | 71 // We want the images to load and JavaScript to be on. |
| 71 m_helper.initialize(true, 0, 0, &configureSettings); | 72 m_helper.initialize(true, 0, 0, &configureSettings); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void TearDown() override | 75 void TearDown() override |
| 75 { | 76 { |
| 76 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 77 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 78 WebCache::clear(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void setBaseFolder(const char* folder) | 81 void setBaseFolder(const char* folder) |
| 80 { | 82 { |
| 81 m_folder = WebString::fromUTF8(folder); | 83 m_folder = WebString::fromUTF8(folder); |
| 82 } | 84 } |
| 83 | 85 |
| 84 void setRewriteURLFolder(const char* folder) | 86 void setRewriteURLFolder(const char* folder) |
| 85 { | 87 { |
| 86 m_rewriteFolder = folder; | 88 m_rewriteFolder = folder; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 100 { | 102 { |
| 101 WebURLError error; | 103 WebURLError error; |
| 102 error.reason = 0xdead + statusCode; | 104 error.reason = 0xdead + statusCode; |
| 103 error.domain = "FrameSerializerTest"; | 105 error.domain = "FrameSerializerTest"; |
| 104 | 106 |
| 105 WebURLResponse response; | 107 WebURLResponse response; |
| 106 response.initialize(); | 108 response.initialize(); |
| 107 response.setMIMEType("text/html"); | 109 response.setMIMEType("text/html"); |
| 108 response.setHTTPStatusCode(statusCode); | 110 response.setHTTPStatusCode(statusCode); |
| 109 | 111 |
| 110 Platform::current()->unitTestSupport()->registerMockedErrorURL(KURL(m_ba
seUrl, file), response, error); | 112 Platform::current()->getURLLoaderMockFactory()->registerErrorURL(KURL(m_
baseUrl, file), response, error); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void registerRewriteURL(const char* fromURL, const char* toURL) | 115 void registerRewriteURL(const char* fromURL, const char* toURL) |
| 114 { | 116 { |
| 115 m_rewriteURLs.add(fromURL, toURL); | 117 m_rewriteURLs.add(fromURL, toURL); |
| 116 } | 118 } |
| 117 | 119 |
| 118 void serialize(const char* url) | 120 void serialize(const char* url) |
| 119 { | 121 { |
| 120 FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), KURL(m_base
Url, url).getString().utf8().data()); | 122 FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), KURL(m_base
Url, url).getString().utf8().data()); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 EXPECT_EQ("saved from url=(0015)http://foo.com/", FrameSerializer::markOfThe
WebDeclaration(KURL(ParsedURLString, "http://foo.com"))); | 526 EXPECT_EQ("saved from url=(0015)http://foo.com/", FrameSerializer::markOfThe
WebDeclaration(KURL(ParsedURLString, "http://foo.com"))); |
| 525 EXPECT_EQ("saved from url=(0015)http://f-o.com/", FrameSerializer::markOfThe
WebDeclaration(KURL(ParsedURLString, "http://f-o.com"))); | 527 EXPECT_EQ("saved from url=(0015)http://f-o.com/", FrameSerializer::markOfThe
WebDeclaration(KURL(ParsedURLString, "http://f-o.com"))); |
| 526 EXPECT_EQ("saved from url=(0019)http://foo.com-%2D/", FrameSerializer::markO
fTheWebDeclaration(KURL(ParsedURLString, "http://foo.com--"))); | 528 EXPECT_EQ("saved from url=(0019)http://foo.com-%2D/", FrameSerializer::markO
fTheWebDeclaration(KURL(ParsedURLString, "http://foo.com--"))); |
| 527 EXPECT_EQ("saved from url=(0024)http://f-%2D.com-%2D%3E/", FrameSerializer::
markOfTheWebDeclaration(KURL(ParsedURLString, "http://f--.com-->"))); | 529 EXPECT_EQ("saved from url=(0024)http://f-%2D.com-%2D%3E/", FrameSerializer::
markOfTheWebDeclaration(KURL(ParsedURLString, "http://f--.com-->"))); |
| 528 EXPECT_EQ("saved from url=(0020)http://foo.com/?-%2D", FrameSerializer::mark
OfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com?--"))); | 530 EXPECT_EQ("saved from url=(0020)http://foo.com/?-%2D", FrameSerializer::mark
OfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com?--"))); |
| 529 EXPECT_EQ("saved from url=(0020)http://foo.com/#-%2D", FrameSerializer::mark
OfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#--"))); | 531 EXPECT_EQ("saved from url=(0020)http://foo.com/#-%2D", FrameSerializer::mark
OfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#--"))); |
| 530 EXPECT_EQ("saved from url=(0026)http://foo.com/#bar-%2Dbaz", FrameSerializer
::markOfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#bar--baz"))); | 532 EXPECT_EQ("saved from url=(0026)http://foo.com/#bar-%2Dbaz", FrameSerializer
::markOfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#bar--baz"))); |
| 531 } | 533 } |
| 532 | 534 |
| 533 } // namespace blink | 535 } // namespace blink |
| OLD | NEW |