| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 m_supportedSchemes[0] = "http"; | 59 m_supportedSchemes[0] = "http"; |
| 60 m_supportedSchemes[1] = "https"; | 60 m_supportedSchemes[1] = "https"; |
| 61 m_supportedSchemes[2] = "file"; | 61 m_supportedSchemes[2] = "file"; |
| 62 } | 62 } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 virtual void SetUp() | 65 virtual void SetUp() |
| 66 { | 66 { |
| 67 // Create and initialize the WebView. | 67 // Create and initialize the WebView. |
| 68 m_webView = WebView::create(0); | 68 m_webView = WebView::create(0); |
| 69 m_webView->initializeMainFrame(&m_webFrameClient); | 69 m_mainFrame = WebFrame::create(&m_webFrameClient); |
| 70 m_webView->initializeMainFrame(m_mainFrame); |
| 70 } | 71 } |
| 71 | 72 |
| 72 virtual void TearDown() | 73 virtual void TearDown() |
| 73 { | 74 { |
| 74 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 75 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 75 m_webView->close(); | 76 m_webView->close(); |
| 77 m_mainFrame->close(); |
| 76 } | 78 } |
| 77 | 79 |
| 78 void registerMockedURLLoad(const std::string& url, const WebString& fileName
) | 80 void registerMockedURLLoad(const std::string& url, const WebString& fileName
) |
| 79 { | 81 { |
| 80 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::
fromUTF8("pageserialization/"), WebString::fromUTF8("text/html")); | 82 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::
fromUTF8("pageserialization/"), WebString::fromUTF8("text/html")); |
| 81 } | 83 } |
| 82 | 84 |
| 83 void loadURLInTopFrame(const WebURL& url) | 85 void loadURLInTopFrame(const WebURL& url) |
| 84 { | 86 { |
| 85 WebURLRequest urlRequest; | 87 WebURLRequest urlRequest; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 100 { | 102 { |
| 101 for (size_t i = 0; i < urls.size(); i++) | 103 for (size_t i = 0; i < urls.size(); i++) |
| 102 printf("%s\n", urls[i].spec().data()); | 104 printf("%s\n", urls[i].spec().data()); |
| 103 } | 105 } |
| 104 | 106 |
| 105 WebView* m_webView; | 107 WebView* m_webView; |
| 106 WebVector<WebCString> m_supportedSchemes; | 108 WebVector<WebCString> m_supportedSchemes; |
| 107 | 109 |
| 108 private: | 110 private: |
| 109 TestWebFrameClient m_webFrameClient; | 111 TestWebFrameClient m_webFrameClient; |
| 112 WebFrame* m_mainFrame; |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 TEST_F(WebPageSerializerTest, HTMLNodes) | 115 TEST_F(WebPageSerializerTest, HTMLNodes) |
| 113 { | 116 { |
| 114 // Register the mocked frame and load it. | 117 // Register the mocked frame and load it. |
| 115 WebURL topFrameURL = toKURL("http://www.test.com"); | 118 WebURL topFrameURL = toKURL("http://www.test.com"); |
| 116 registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("simple_pag
e.html")); | 119 registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("simple_pag
e.html")); |
| 117 registerMockedURLLoad("http://www.example.com/beautifull.css", WebString::fr
omUTF8("beautifull.css")); | 120 registerMockedURLLoad("http://www.example.com/beautifull.css", WebString::fr
omUTF8("beautifull.css")); |
| 118 loadURLInTopFrame(topFrameURL); | 121 loadURLInTopFrame(topFrameURL); |
| 119 | 122 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/innerFrame.png
")); | 184 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/innerFrame.png
")); |
| 182 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/flash.swf")); | 185 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/flash.swf")); |
| 183 // FIXME: for some reason the following resources is missing on one of the b
ot | 186 // FIXME: for some reason the following resources is missing on one of the b
ot |
| 184 // causing the test to fail. Probably a plugin issue. | 187 // causing the test to fail. Probably a plugin issue. |
| 185 // EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/music.mid")
); | 188 // EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/music.mid")
); |
| 186 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/object.png")); | 189 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/object.png")); |
| 187 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/embed.png")); | 190 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/embed.png")); |
| 188 } | 191 } |
| 189 | 192 |
| 190 } | 193 } |
| OLD | NEW |