Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2203)

Unified Diff: chrome/test/chromedriver/session.cc

Issue 23467010: [chromedriver] Logging tweaks and fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/chromedriver/session.h ('k') | chrome/test/chromedriver/session_commands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/session.cc
diff --git a/chrome/test/chromedriver/session.cc b/chrome/test/chromedriver/session.cc
index 3dc1e01f9b0426dc8a88a284f22e55aba0a7bad6..a133832da828345795d6539d25a173453ac83cca 100644
--- a/chrome/test/chromedriver/session.cc
+++ b/chrome/test/chromedriver/session.cc
@@ -6,6 +6,8 @@
#include <list>
+#include "base/lazy_instance.h"
+#include "base/threading/thread_local.h"
#include "base/values.h"
#include "chrome/test/chromedriver/chrome/chrome.h"
#include "chrome/test/chromedriver/chrome/status.h"
@@ -13,6 +15,13 @@
#include "chrome/test/chromedriver/chrome/web_view.h"
#include "chrome/test/chromedriver/logging.h"
+namespace {
+
+base::LazyInstance<base::ThreadLocalPointer<Session> >
+ lazy_tls_session = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
FrameInfo::FrameInfo(const std::string& parent_frame_id,
const std::string& frame_id,
const std::string& chromedriver_frame_id)
@@ -40,8 +49,7 @@ Session::Session(const std::string& id, scoped_ptr<Chrome> chrome)
chrome(chrome.Pass()),
sticky_modifiers(0),
mouse_position(0, 0),
- page_load_timeout(kDefaultPageLoadTimeout),
- capabilities(CreateCapabilities()) {}
+ page_load_timeout(kDefaultPageLoadTimeout) {}
Session::~Session() {}
@@ -73,23 +81,22 @@ std::string Session::GetCurrentFrameId() const {
return frames.back().frame_id;
}
-scoped_ptr<base::DictionaryValue> Session::CreateCapabilities() {
- scoped_ptr<base::DictionaryValue> caps(new base::DictionaryValue());
- caps->SetString("browserName", "chrome");
- caps->SetString("version", chrome->GetVersion());
- caps->SetString("chrome.chromedriverVersion", kChromeDriverVersion);
- caps->SetString("platform", chrome->GetOperatingSystemName());
- caps->SetBoolean("javascriptEnabled", true);
- caps->SetBoolean("takesScreenshot", true);
- caps->SetBoolean("handlesAlerts", true);
- caps->SetBoolean("databaseEnabled", true);
- caps->SetBoolean("locationContextEnabled", true);
- caps->SetBoolean("applicationCacheEnabled", false);
- caps->SetBoolean("browserConnectionEnabled", false);
- caps->SetBoolean("cssSelectorsEnabled", true);
- caps->SetBoolean("webStorageEnabled", true);
- caps->SetBoolean("rotatable", false);
- caps->SetBoolean("acceptSslCerts", true);
- caps->SetBoolean("nativeEvents", true);
- return caps.Pass();
+std::vector<WebDriverLog*> Session::GetAllLogs() const {
+ std::vector<WebDriverLog*> logs;
+ for (ScopedVector<WebDriverLog>::const_iterator log = devtools_logs.begin();
+ log != devtools_logs.end();
+ ++log) {
+ logs.push_back(*log);
+ }
+ if (driver_log)
+ logs.push_back(driver_log.get());
+ return logs;
+}
+
+Session* GetThreadLocalSession() {
+ return lazy_tls_session.Pointer()->Get();
+}
+
+void SetThreadLocalSession(scoped_ptr<Session> session) {
+ lazy_tls_session.Pointer()->Set(session.release());
}
« no previous file with comments | « chrome/test/chromedriver/session.h ('k') | chrome/test/chromedriver/session_commands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698