#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_view_observer.h"
+#include "content/public/test/content_browser_test.h"
+#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/renderer/savable_resources.h"
#include "content/shell/browser/shell.h"
-#include "content/test/content_browser_test.h"
-#include "content/test/content_browser_test_utils.h"
-#include "net/base/net_util.h"
+#include "net/base/filename_util.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/platform/WebCString.h"
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebElementCollection.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebNode.h"
-#include "third_party/WebKit/public/web/WebNodeCollection.h"
#include "third_party/WebKit/public/web/WebNodeList.h"
#include "third_party/WebKit/public/web/WebPageSerializer.h"
#include "third_party/WebKit/public/web/WebPageSerializerClient.h"
#include "third_party/WebKit/public/web/WebView.h"
-using WebKit::WebCString;
-using WebKit::WebData;
-using WebKit::WebDocument;
-using WebKit::WebElement;
-using WebKit::WebFrame;
-using WebKit::WebNode;
-using WebKit::WebNodeCollection;
-using WebKit::WebNodeList;
-using WebKit::WebPageSerializer;
-using WebKit::WebPageSerializerClient;
-using WebKit::WebNode;
-using WebKit::WebString;
-using WebKit::WebURL;
-using WebKit::WebView;
-using WebKit::WebVector;
+using blink::WebCString;
+using blink::WebData;
+using blink::WebDocument;
+using blink::WebElement;
+using blink::WebElementCollection;
+using blink::WebFrame;
+using blink::WebLocalFrame;
+using blink::WebNode;
+using blink::WebNodeList;
+using blink::WebPageSerializer;
+using blink::WebPageSerializerClient;
+using blink::WebString;
+using blink::WebURL;
+using blink::WebView;
+using blink::WebVector;
+
+namespace {
+
+// The first RenderFrame is routing ID 1, and the first RenderView is 2.
+const int kRenderViewRoutingId = 2;
+
+}
namespace content {
stack.pop_back();
if (GURL(current_frame->document().url()) == url)
return current_frame;
- WebNodeCollection all = current_frame->document().all();
- for (WebNode node = all.firstItem();
- !node.isNull(); node = all.nextItem()) {
- if (!node.isElementNode())
- continue;
+ WebElementCollection all = current_frame->document().all();
+ for (WebElement element = all.firstItem();
+ !element.isNull(); element = all.nextItem()) {
// Check frame tag and iframe tag
- WebElement element = node.to<WebElement>();
- if (!element.hasTagName("frame") && !element.hasTagName("iframe"))
+ if (!element.hasHTMLTagName("frame") && !element.hasHTMLTagName("iframe"))
continue;
- WebFrame* sub_frame = WebFrame::fromFrameOwnerElement(element);
+ WebFrame* sub_frame = WebLocalFrame::fromFrameOwnerElement(element);
if (sub_frame)
stack.push_back(sub_frame);
}
if (!node.isElementNode())
return false;
const WebElement meta = node.toConst<WebElement>();
- if (!meta.hasTagName("meta"))
+ if (!meta.hasHTMLTagName("meta"))
return false;
charset_info.erase(0, charset_info.length());
// Check the META charset declaration.
: RenderViewObserver(render_view),
quit_closure_(quit_closure) {}
- virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE {
+ virtual void DidFinishLoad(blink::WebLocalFrame* frame) OVERRIDE {
if (frame == render_view()->GetWebView()->mainFrame())
quit_closure_.Run();
}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
command_line->AppendSwitch(switches::kSingleProcess);
-#if defined(OS_WIN) && defined(USE_AURA)
+#if defined(OS_WIN)
// Don't want to try to create a GPU process.
- command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
+ command_line->AppendSwitch(switches::kDisableGpu);
#endif
}
RenderView* GetRenderView() {
// We could have the test on the UI thread get the WebContent's routing ID,
// but we know this will be the first RV so skip that and just hardcode it.
- return RenderView::FromRoutingID(1);
+ return RenderView::FromRoutingID(kRenderViewRoutingId);
}
WebView* GetWebView() {
WebVector<WebString> local_paths;
local_paths.assign(&file_path, 1);
// Start serializing DOM.
- bool result = WebPageSerializer::serialize(web_frame,
+ bool result = WebPageSerializer::serialize(web_frame->toWebLocalFrame(),
recursive_serialization,
static_cast<WebPageSerializerClient*>(this),
links,
'%', 0x2285, 0x00b9, '\'', 0
};
WebString value = body_element.getAttribute("title");
- ASSERT_TRUE(UTF16ToWide(value) == parsed_value);
- ASSERT_TRUE(UTF16ToWide(body_element.innerText()) == parsed_value);
+ ASSERT_TRUE(base::UTF16ToWide(value) == parsed_value);
+ ASSERT_TRUE(base::UTF16ToWide(body_element.innerText()) == parsed_value);
// Do serialization.
SerializeDomForURL(file_url, false);
WebDocument doc = web_frame->document();
ASSERT_TRUE(doc.isHTMLDocument());
// Go through all descent nodes.
- WebNodeCollection all = doc.all();
+ WebElementCollection all = doc.all();
int original_base_tag_count = 0;
- for (WebNode node = all.firstItem(); !node.isNull();
- node = all.nextItem()) {
- if (!node.isElementNode())
- continue;
- WebElement element = node.to<WebElement>();
- if (element.hasTagName("base")) {
+ for (WebElement element = all.firstItem(); !element.isNull();
+ element = all.nextItem()) {
+ if (element.hasHTMLTagName("base")) {
original_base_tag_count++;
} else {
// Get link.
WebString value = GetSubResourceLinkFromElement(element);
- if (value.isNull() && element.hasTagName("a")) {
+ if (value.isNull() && element.hasHTMLTagName("a")) {
value = element.getAttribute("href");
if (value.isEmpty())
value = WebString();
if (!node.isElementNode())
continue;
WebElement element = node.to<WebElement>();
- if (element.hasTagName("base")) {
+ if (element.hasHTMLTagName("base")) {
new_base_tag_count++;
} else {
// Get link.
WebString value = GetSubResourceLinkFromElement(element);
- if (value.isNull() && element.hasTagName("a")) {
+ if (value.isNull() && element.hasHTMLTagName("a")) {
value = element.getAttribute("href");
if (value.isEmpty())
value = WebString();
// Serialize XML document which has all 5 built-in entities. After
// finishing serialization, the serialized contents should be same
// with original XML document.
-IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeXMLDocWithBuiltInEntities) {
+//
+// TODO(tiger@opera.com): Disabled in preparation of page serializer merge --
+// XML headers are handled differently in the merged serializer.
+// Bug: http://crbug.com/328354
+IN_PROC_BROWSER_TEST_F(DomSerializerTests,
+ DISABLED_SerializeXMLDocWithBuiltInEntities) {
base::FilePath page_file_path =
GetTestFilePath("dom_serializer", "note.html");
base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml");
// Test situation of html entities in attribute value when serializing
// HTML DOM.
// This test started to fail at WebKit r65388. See http://crbug.com/52279.
+//
+// TODO(tiger@opera.com): Disabled in preparation of page serializer merge --
+// Some attributes are handled differently in the merged serializer.
+// Bug: http://crbug.com/328354
IN_PROC_BROWSER_TEST_F(DomSerializerTests,
- SerializeHTMLDOMWithEntitiesInAttributeValue) {
+ DISABLED_SerializeHTMLDOMWithEntitiesInAttributeValue) {
// Need to spin up the renderer and also navigate to a file url so that the
// renderer code doesn't attempt a fork when it sees a load to file scheme
// from non-file scheme.
// When serializing, we should comment the BASE tag, append a new BASE tag.
// rewrite all the savable URLs to relative local path, and change other URLs
// to absolute URLs.
-IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithBaseTag) {
+//
+// TODO(tiger@opera.com): Disabled in preparation of page serializer merge --
+// Base tags are handled a bit different in merged version.
+// Bug: http://crbug.com/328354
+IN_PROC_BROWSER_TEST_F(DomSerializerTests,
+ DISABLED_SerializeHTMLDOMWithBaseTag) {
base::FilePath page_file_path = GetTestFilePath(
"dom_serializer", "html_doc_has_base_tag.htm");