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 |
54 namespace content { | 61 namespace content { |
55 | 62 |
56 // Iterate recursively over sub-frames to find one with with a given url. | 63 // Iterate recursively over sub-frames to find one with with a given url. |
57 WebFrame* FindSubFrameByURL(WebView* web_view, const GURL& url) { | 64 WebFrame* FindSubFrameByURL(WebView* web_view, const GURL& url) { |
58 if (!web_view->mainFrame()) | 65 if (!web_view->mainFrame()) |
59 return NULL; | 66 return NULL; |
60 | 67 |
61 std::vector<WebFrame*> stack; | 68 std::vector<WebFrame*> stack; |
62 stack.push_back(web_view->mainFrame()); | 69 stack.push_back(web_view->mainFrame()); |
63 | 70 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 223 } |
217 | 224 |
218 const std::string& GetSerializedContentForFrame( | 225 const std::string& GetSerializedContentForFrame( |
219 const GURL& frame_url) { | 226 const GURL& frame_url) { |
220 return serialized_frame_map_[frame_url.spec()]; | 227 return serialized_frame_map_[frame_url.spec()]; |
221 } | 228 } |
222 | 229 |
223 RenderView* GetRenderView() { | 230 RenderView* GetRenderView() { |
224 // We could have the test on the UI thread get the WebContent's routing ID, | 231 // We could have the test on the UI thread get the WebContent's routing ID, |
225 // but we know this will be the first RV so skip that and just hardcode it. | 232 // but we know this will be the first RV so skip that and just hardcode it. |
226 return RenderView::FromRoutingID(1); | 233 return RenderView::FromRoutingID(kRenderViewRoutingId); |
227 } | 234 } |
228 | 235 |
229 WebView* GetWebView() { | 236 WebView* GetWebView() { |
230 return GetRenderView()->GetWebView(); | 237 return GetRenderView()->GetWebView(); |
231 } | 238 } |
232 | 239 |
233 WebFrame* GetMainFrame() { | 240 WebFrame* GetMainFrame() { |
234 return GetWebView()->mainFrame(); | 241 return GetWebView()->mainFrame(); |
235 } | 242 } |
236 | 243 |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 NavigateToURL(shell(), file_url); | 1009 NavigateToURL(shell(), file_url); |
1003 | 1010 |
1004 PostTaskToInProcessRendererAndWait( | 1011 PostTaskToInProcessRendererAndWait( |
1005 base::Bind( | 1012 base::Bind( |
1006 &DomSerializerTests:: | 1013 &DomSerializerTests:: |
1007 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1014 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
1008 base::Unretained(this), file_url)); | 1015 base::Unretained(this), file_url)); |
1009 } | 1016 } |
1010 | 1017 |
1011 } // namespace content | 1018 } // namespace content |
OLD | NEW |