diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-04 17:36:38 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-04 17:36:38 +0000 |
commit | a57b892e3f080edae1d5740635750d3566c04164 (patch) | |
tree | ec71df0c1a06ae51ddf037bd3a79540bd13d42b0 | |
parent | 929252eb107266fb3577a5dfb2aee5f6624c0651 (diff) | |
download | chromium_src-a57b892e3f080edae1d5740635750d3566c04164.zip chromium_src-a57b892e3f080edae1d5740635750d3566c04164.tar.gz chromium_src-a57b892e3f080edae1d5740635750d3566c04164.tar.bz2 |
Few fixes to get tests working. Create/delete Automation on session thread,
terminate the session correctly, and stop chrome driver at the end of the
webdriver tests.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6334110
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73815 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/webdriver/commands/session_with_id.cc | 1 | ||||
-rw-r--r-- | chrome/test/webdriver/run_webdriver_tests.py | 1 | ||||
-rw-r--r-- | chrome/test/webdriver/session.cc | 19 | ||||
-rw-r--r-- | chrome/test/webdriver/session.h | 16 |
4 files changed, 27 insertions, 10 deletions
diff --git a/chrome/test/webdriver/commands/session_with_id.cc b/chrome/test/webdriver/commands/session_with_id.cc index ea7cc1c..2ae2f8c 100644 --- a/chrome/test/webdriver/commands/session_with_id.cc +++ b/chrome/test/webdriver/commands/session_with_id.cc @@ -40,6 +40,7 @@ void SessionWithID::ExecuteGet(Response* const response) { } void SessionWithID::ExecuteDelete(Response* const response) { + session_->Terminate(); SessionManager::GetInstance()->Delete(session_->id()); response->set_status(kSuccess); } diff --git a/chrome/test/webdriver/run_webdriver_tests.py b/chrome/test/webdriver/run_webdriver_tests.py index 0b2e0dc..bd43942 100644 --- a/chrome/test/webdriver/run_webdriver_tests.py +++ b/chrome/test/webdriver/run_webdriver_tests.py @@ -271,6 +271,7 @@ class Main(object): if self._options.verbose: verbosity = 2 result = GTestTextTestRunner(verbosity=verbosity).run(test_suite) + launcher.Kill() sys.exit(not result.wasSuccessful()) diff --git a/chrome/test/webdriver/session.cc b/chrome/test/webdriver/session.cc index 96fa461..0247498 100644 --- a/chrome/test/webdriver/session.cc +++ b/chrome/test/webdriver/session.cc @@ -39,20 +39,19 @@ bool Session::Init() { LOG(ERROR) << "Cannot start session thread"; return false; } - automation_.reset(new Automation()); bool success = false; RunSessionTask(NewRunnableMethod( - automation_.get(), - &Automation::Init, + this, + &Session::InitOnSessionThread, &success)); return success; } void Session::Terminate() { RunSessionTask(NewRunnableMethod( - automation_.get(), - &Automation::Terminate)); + this, + &Session::TerminateOnSessionThread)); } ErrorCode Session::ExecuteScript(const std::wstring& script, @@ -203,4 +202,14 @@ void Session::RunSessionTaskOnSessionThread(Task* task, done_event->Signal(); } +void Session::InitOnSessionThread(bool* success) { + automation_.reset(new Automation()); + automation_->Init(success); +} + +void Session::TerminateOnSessionThread() { + automation_->Terminate(); + automation_.reset(); +} + } // namespace webdriver diff --git a/chrome/test/webdriver/session.h b/chrome/test/webdriver/session.h index d93db24..5284b24 100644 --- a/chrome/test/webdriver/session.h +++ b/chrome/test/webdriver/session.h @@ -11,6 +11,10 @@ #include "chrome/test/webdriver/automation.h" #include "chrome/test/webdriver/error_codes.h" +namespace base { +class WaitableEvent; +} + namespace webdriver { // Every connection made by WebDriver maps to a session object. @@ -45,11 +49,6 @@ class Session { bool Reload(); bool GetURL(std::string* url); bool GetTabTitle(std::string* tab_title); - void RunSessionTask(Task* task); - void RunSessionTaskOnSessionThread( - Task* task, - base::WaitableEvent* done_event); - inline const std::string& id() const { return id_; } @@ -73,6 +72,13 @@ class Session { } private: + void RunSessionTask(Task* task); + void RunSessionTaskOnSessionThread( + Task* task, + base::WaitableEvent* done_event); + void InitOnSessionThread(bool* success); + void TerminateOnSessionThread(); + scoped_ptr<Automation> automation_; base::Thread thread_; |