diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-26 03:45:05 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-26 03:45:05 +0000 |
commit | dbe79aa3f36da84af6d62fe90ff4488c6dbd0126 (patch) | |
tree | 6da201ef392d43887f98d02ea7eeb6511de4d10e /chrome/test | |
parent | fcb247c3df9d8f7bd304d51c7473318cb256f119 (diff) | |
download | chromium_src-dbe79aa3f36da84af6d62fe90ff4488c6dbd0126.zip chromium_src-dbe79aa3f36da84af6d62fe90ff4488c6dbd0126.tar.gz chromium_src-dbe79aa3f36da84af6d62fe90ff4488c6dbd0126.tar.bz2 |
In chromedriver, fix and cleanup the command to get the page source.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6745030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79485 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/webdriver/WEBDRIVER_TESTS | 4 | ||||
-rw-r--r-- | chrome/test/webdriver/commands/source_command.cc | 21 | ||||
-rw-r--r-- | chrome/test/webdriver/commands/source_command.h | 10 |
3 files changed, 14 insertions, 21 deletions
diff --git a/chrome/test/webdriver/WEBDRIVER_TESTS b/chrome/test/webdriver/WEBDRIVER_TESTS index 6b574bb..b41912d 100644 --- a/chrome/test/webdriver/WEBDRIVER_TESTS +++ b/chrome/test/webdriver/WEBDRIVER_TESTS @@ -40,6 +40,8 @@ 'frame_switching_tests', 'implicit_waits_tests', 'page_loading_tests', + # Flaky. crbug.com/77495. + '-page_loading_tests.PageLoadingTests.testShouldBeAbleToNavigateBackInTheBrowserHistory', # This test causes the test after to fail occassionally. See # crbug.com/72027. This is because we are not waiting for navigation # error pages. @@ -52,8 +54,6 @@ 'select_element_handling_tests', 'stale_reference_tests', 'text_handling_tests', - # Getting the page source is broken. - '-text_handling_tests.TextHandlingTests.testReadALargeAmountOfData', # Chrome bug/oddity. See crbug.com/76111. '-text_handling_tests.TextHandlingTests.testShouldBeAbleToSetMoreThanOneLineOfTextInATextArea', # See issue 1225 on the webdriver OSS tracker. diff --git a/chrome/test/webdriver/commands/source_command.cc b/chrome/test/webdriver/commands/source_command.cc index bd68b2f..94c5e8e 100644 --- a/chrome/test/webdriver/commands/source_command.cc +++ b/chrome/test/webdriver/commands/source_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,14 +6,16 @@ #include <string> +#include "base/values.h" #include "chrome/test/webdriver/commands/response.h" +#include "chrome/test/webdriver/error_codes.h" +#include "chrome/test/webdriver/session.h" namespace webdriver { // Private atom to find source code of the page. const char* const kSource = - "window.domAutomationController.send(" - "new XMLSerializer().serializeToString(document));"; + "return new XMLSerializer().serializeToString(document);"; SourceCommand::SourceCommand(const std::vector<std::string>& path_segments, const DictionaryValue* const parameters) @@ -26,14 +28,11 @@ bool SourceCommand::DoesGet() { } void SourceCommand::ExecuteGet(Response* const response) { + ListValue args; Value* result = NULL; + ErrorCode code = session_->ExecuteScript(kSource, &args, &result); - scoped_ptr<ListValue> list(new ListValue()); - if (!session_->ExecuteScript(kSource, list.get(), &result)) { - LOG(ERROR) << "Could not execute JavaScript to find source. JavaScript" - << " used was:\n" << kSource; - LOG(ERROR) << "ExecuteAndExtractString's results was: " - << result; + if (code != kSuccess) { SET_WEBDRIVER_ERROR(response, "ExecuteAndExtractString failed", kInternalServerError); return; @@ -42,8 +41,4 @@ void SourceCommand::ExecuteGet(Response* const response) { response->SetStatus(kSuccess); } -bool SourceCommand::RequiresValidTab() { - return true; -} - } // namespace webdriver diff --git a/chrome/test/webdriver/commands/source_command.h b/chrome/test/webdriver/commands/source_command.h index cc8b1e7..0248d34 100644 --- a/chrome/test/webdriver/commands/source_command.h +++ b/chrome/test/webdriver/commands/source_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -10,12 +10,13 @@ #include "chrome/test/webdriver/commands/webdriver_command.h" +class DictionaryValue; + namespace webdriver { class Response; -// Controls navigate to new web pages for the current tab. A call with -// an HTTP GET will return the source of the tab. See: +// Gets the page source. See: // http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/source class SourceCommand : public WebDriverCommand { public: @@ -27,12 +28,9 @@ class SourceCommand : public WebDriverCommand { virtual void ExecuteGet(Response* const response); private: - virtual bool RequiresValidTab(); - DISALLOW_COPY_AND_ASSIGN(SourceCommand); }; } // namespace webdriver #endif // CHROME_TEST_WEBDRIVER_COMMANDS_SOURCE_COMMAND_H_ - |