diff options
-rw-r--r-- | chrome/renderer/resources/dom_automation.js | 4 | ||||
-rw-r--r-- | chrome/test/automation/dom_element_proxy.cc | 6 | ||||
-rw-r--r-- | chrome/test/automation/dom_element_proxy.h | 3 | ||||
-rw-r--r-- | chrome/test/data/layout_tests/layout_test_controller.html | 3 | ||||
-rw-r--r-- | chrome/test/ui/ui_layout_test.cc | 16 | ||||
-rw-r--r-- | content/browser/in_process_webkit/dom_storage_uitest.cc | 8 |
6 files changed, 24 insertions, 16 deletions
diff --git a/chrome/renderer/resources/dom_automation.js b/chrome/renderer/resources/dom_automation.js index 0af645b..de93904 100644 --- a/chrome/renderer/resources/dom_automation.js +++ b/chrome/renderer/resources/dom_automation.js @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -399,6 +399,8 @@ var domAutomation = domAutomation || {}; return element.id; } else if (type == "contentdocument") { return element.contentDocument; + } else if (type == "innertext") { + return element.innerText; } } diff --git a/chrome/test/automation/dom_element_proxy.cc b/chrome/test/automation/dom_element_proxy.cc index e11a48f..3417c5a 100644 --- a/chrome/test/automation/dom_element_proxy.cc +++ b/chrome/test/automation/dom_element_proxy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -222,6 +222,10 @@ bool DOMElementProxy::GetText(std::string* text) { return GetValue("text", text); } +bool DOMElementProxy::GetInnerText(std::string* text) { + return GetValue("innertext", text); +} + bool DOMElementProxy::GetInnerHTML(std::string* html) { return GetValue("innerhtml", html); } diff --git a/chrome/test/automation/dom_element_proxy.h b/chrome/test/automation/dom_element_proxy.h index d1e1b71..7cd2839 100644 --- a/chrome/test/automation/dom_element_proxy.h +++ b/chrome/test/automation/dom_element_proxy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -144,6 +144,7 @@ class DOMElementProxy : public JavaScriptObjectProxy { // Retrieves all the text in this element. This includes the value // of textfields and inputs. Returns true on success. bool GetText(std::string* text); + bool GetInnerText(std::string* text); // Retrieves the element's inner HTML. Returns true on success. bool GetInnerHTML(std::string* html); diff --git a/chrome/test/data/layout_tests/layout_test_controller.html b/chrome/test/data/layout_tests/layout_test_controller.html index 198c385..226b18d 100644 --- a/chrome/test/data/layout_tests/layout_test_controller.html +++ b/chrome/test/data/layout_tests/layout_test_controller.html @@ -28,8 +28,7 @@ function LayoutTestController() { }; this.DelayedNotifyDone2 = function () { - var token = encodeURIComponent(document.body.innerText); - document.cookie = "%COOKIE%=" + token; + document.cookie = "%COOKIE%=done"; }; this.OnEvent = function () { diff --git a/chrome/test/ui/ui_layout_test.cc b/chrome/test/ui/ui_layout_test.cc index e9b479b..5061d47 100644 --- a/chrome/test/ui/ui_layout_test.cc +++ b/chrome/test/ui/ui_layout_test.cc @@ -34,6 +34,7 @@ static const char kTestCompleteCookie[] = "status"; UILayoutTest::UILayoutTest() : initialized_for_layout_test_(false), test_count_(0) { + dom_automation_enabled_ = true; } UILayoutTest::~UILayoutTest() { @@ -219,12 +220,13 @@ void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name, WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), status_cookie.c_str(), TestTimeouts::action_max_timeout_ms()); - // Unescapes and normalizes the actual result. - std::string value = net::UnescapeURLComponent(escaped_value, - net::UnescapeRule::NORMAL | net::UnescapeRule::SPACES | - net::UnescapeRule::URL_SPECIAL_CHARS | net::UnescapeRule::CONTROL_CHARS); - value += "\n"; - ReplaceSubstringsAfterOffset(&value, 0, "\r", ""); + DOMElementProxyRef body = + tab->GetDOMDocument()->FindElement(DOMElementProxy::By::XPath("//body")); + ASSERT_TRUE(body.get()); + std::string inner_text; + ASSERT_TRUE(body->GetInnerText(&inner_text)); + inner_text += "\n"; + ReplaceSubstringsAfterOffset(&inner_text, 0, "\r", ""); // Reads the expected result. First try to read from rebase directory. // If failed, read from original directory. @@ -249,7 +251,7 @@ void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name, ReplaceSubstringsAfterOffset(&expected_result_value, 0, "\r", ""); // Compares the results. - EXPECT_STREQ(expected_result_value.c_str(), value.c_str()); + EXPECT_STREQ(expected_result_value.c_str(), inner_text.c_str()); VLOG(1) << "Test " << test_case_file_name << " took " << (base::Time::Now() - start).InMilliseconds() << "ms"; diff --git a/content/browser/in_process_webkit/dom_storage_uitest.cc b/content/browser/in_process_webkit/dom_storage_uitest.cc index 886941f..1c6d4b0 100644 --- a/content/browser/in_process_webkit/dom_storage_uitest.cc +++ b/content/browser/in_process_webkit/dom_storage_uitest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,9 +22,9 @@ static const char* kRootFiles[] = { }; static const char* kEventsFiles[] = { -// "basic-body-attribute.html", // crbug.com/33472 -// "basic.html", // crbug.com/33472 -// "basic-setattribute.html", // crbug.com/33472 + "basic-body-attribute.html", + "basic.html", + "basic-setattribute.html", "case-sensitive.html", "documentURI.html", NULL |