| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 using blink::WebNodeCollection; | 44 using blink::WebNodeCollection; |
| 45 using blink::WebNodeList; | 45 using blink::WebNodeList; |
| 46 using blink::WebPageSerializer; | 46 using blink::WebPageSerializer; |
| 47 using blink::WebPageSerializerClient; | 47 using blink::WebPageSerializerClient; |
| 48 using blink::WebNode; | 48 using blink::WebNode; |
| 49 using blink::WebString; | 49 using blink::WebString; |
| 50 using blink::WebURL; | 50 using blink::WebURL; |
| 51 using blink::WebView; | 51 using blink::WebView; |
| 52 using blink::WebVector; | 52 using blink::WebVector; |
| 53 | 53 |
| 54 namespace { | |
| 55 | |
| 56 // The first RenderFrame is routing ID 1, and the first RenderView is 2. | |
| 57 const int kRenderViewRoutingId = 2; | |
| 58 | |
| 59 } | |
| 60 | |
| 61 namespace content { | 54 namespace content { |
| 62 | 55 |
| 63 // Iterate recursively over sub-frames to find one with with a given url. | 56 // Iterate recursively over sub-frames to find one with with a given url. |
| 64 WebFrame* FindSubFrameByURL(WebView* web_view, const GURL& url) { | 57 WebFrame* FindSubFrameByURL(WebView* web_view, const GURL& url) { |
| 65 if (!web_view->mainFrame()) | 58 if (!web_view->mainFrame()) |
| 66 return NULL; | 59 return NULL; |
| 67 | 60 |
| 68 std::vector<WebFrame*> stack; | 61 std::vector<WebFrame*> stack; |
| 69 stack.push_back(web_view->mainFrame()); | 62 stack.push_back(web_view->mainFrame()); |
| 70 | 63 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 216 } |
| 224 | 217 |
| 225 const std::string& GetSerializedContentForFrame( | 218 const std::string& GetSerializedContentForFrame( |
| 226 const GURL& frame_url) { | 219 const GURL& frame_url) { |
| 227 return serialized_frame_map_[frame_url.spec()]; | 220 return serialized_frame_map_[frame_url.spec()]; |
| 228 } | 221 } |
| 229 | 222 |
| 230 RenderView* GetRenderView() { | 223 RenderView* GetRenderView() { |
| 231 // We could have the test on the UI thread get the WebContent's routing ID, | 224 // We could have the test on the UI thread get the WebContent's routing ID, |
| 232 // but we know this will be the first RV so skip that and just hardcode it. | 225 // but we know this will be the first RV so skip that and just hardcode it. |
| 233 return RenderView::FromRoutingID(kRenderViewRoutingId); | 226 return RenderView::FromRoutingID(1); |
| 234 } | 227 } |
| 235 | 228 |
| 236 WebView* GetWebView() { | 229 WebView* GetWebView() { |
| 237 return GetRenderView()->GetWebView(); | 230 return GetRenderView()->GetWebView(); |
| 238 } | 231 } |
| 239 | 232 |
| 240 WebFrame* GetMainFrame() { | 233 WebFrame* GetMainFrame() { |
| 241 return GetWebView()->mainFrame(); | 234 return GetWebView()->mainFrame(); |
| 242 } | 235 } |
| 243 | 236 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 NavigateToURL(shell(), file_url); | 1011 NavigateToURL(shell(), file_url); |
| 1019 | 1012 |
| 1020 PostTaskToInProcessRendererAndWait( | 1013 PostTaskToInProcessRendererAndWait( |
| 1021 base::Bind( | 1014 base::Bind( |
| 1022 &DomSerializerTests:: | 1015 &DomSerializerTests:: |
| 1023 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1016 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
| 1024 base::Unretained(this), file_url)); | 1017 base::Unretained(this), file_url)); |
| 1025 } | 1018 } |
| 1026 | 1019 |
| 1027 } // namespace content | 1020 } // namespace content |
| OLD | NEW |