| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/chromedriver/session.h" | 5 #include "chrome/test/chromedriver/session.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 for (std::list<WebView*>::const_iterator it = web_views.begin(); | 45 for (std::list<WebView*>::const_iterator it = web_views.begin(); |
| 46 it != web_views.end(); ++it) { | 46 it != web_views.end(); ++it) { |
| 47 if ((*it)->GetId() == window) { | 47 if ((*it)->GetId() == window) { |
| 48 *web_view = *it; | 48 *web_view = *it; |
| 49 return Status(kOk); | 49 return Status(kOk); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 return Status(kNoSuchWindow, "target window already closed"); | 52 return Status(kNoSuchWindow, "target window already closed"); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void Session::SetToFrame(const std::string& new_frame, |
| 56 const std::string& xpath) { |
| 57 if (new_frame.empty()) { |
| 58 frame = ""; |
| 59 frame_elements.clear(); |
| 60 } else { |
| 61 frame_elements.push_back(FrameInfo(frame, xpath)); |
| 62 frame = new_frame; |
| 63 } |
| 64 } |
| 65 |
| 55 scoped_ptr<base::DictionaryValue> Session::CreateCapabilities() { | 66 scoped_ptr<base::DictionaryValue> Session::CreateCapabilities() { |
| 56 scoped_ptr<base::DictionaryValue> caps(new base::DictionaryValue()); | 67 scoped_ptr<base::DictionaryValue> caps(new base::DictionaryValue()); |
| 57 caps->SetString("browserName", "chrome"); | 68 caps->SetString("browserName", "chrome"); |
| 58 caps->SetString("version", chrome->GetVersion()); | 69 caps->SetString("version", chrome->GetVersion()); |
| 59 caps->SetString("driverVersion", kChromeDriverVersion); | 70 caps->SetString("driverVersion", kChromeDriverVersion); |
| 60 caps->SetString("platform", base::SysInfo::OperatingSystemName()); | 71 caps->SetString("platform", base::SysInfo::OperatingSystemName()); |
| 61 caps->SetBoolean("javascriptEnabled", true); | 72 caps->SetBoolean("javascriptEnabled", true); |
| 62 caps->SetBoolean("takesScreenshot", true); | 73 caps->SetBoolean("takesScreenshot", true); |
| 63 caps->SetBoolean("handlesAlerts", true); | 74 caps->SetBoolean("handlesAlerts", true); |
| 64 caps->SetBoolean("databaseEnabled", true); | 75 caps->SetBoolean("databaseEnabled", true); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 | 86 |
| 76 SessionAccessorImpl::SessionAccessorImpl(scoped_ptr<Session> session) | 87 SessionAccessorImpl::SessionAccessorImpl(scoped_ptr<Session> session) |
| 77 : session_(session.Pass()) {} | 88 : session_(session.Pass()) {} |
| 78 | 89 |
| 79 Session* SessionAccessorImpl::Access(scoped_ptr<base::AutoLock>* lock) { | 90 Session* SessionAccessorImpl::Access(scoped_ptr<base::AutoLock>* lock) { |
| 80 lock->reset(new base::AutoLock(session_lock_)); | 91 lock->reset(new base::AutoLock(session_lock_)); |
| 81 return session_.get(); | 92 return session_.get(); |
| 82 } | 93 } |
| 83 | 94 |
| 84 SessionAccessorImpl::~SessionAccessorImpl() {} | 95 SessionAccessorImpl::~SessionAccessorImpl() {} |
| OLD | NEW |