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

Side by Side Diff: chrome/test/webdriver/session_manager.cc

Issue 5572001: Send screenshots back to the client for debugging (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixed function names and migrated code to new desktop Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/webdriver/session_manager.h" 5 #include "chrome/test/webdriver/session_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/test/webdriver/utility_functions.h" 8 #include "chrome/test/webdriver/utility_functions.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 10
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 #endif 26 #endif
27 if (hostname.empty()) { 27 if (hostname.empty()) {
28 hostname = "localhost"; 28 hostname = "localhost";
29 } 29 }
30 return hostname + ":" + port_ + url_base_; 30 return hostname + ":" + port_ + url_base_;
31 } 31 }
32 32
33 void SessionManager::Add(Session* session) { 33 void SessionManager::Add(Session* session) {
34 base::AutoLock lock(map_lock_); 34 base::AutoLock lock(map_lock_);
35 map_[session->id()] = session; 35 map_[session->Id()] = session;
36 } 36 }
37 37
38 bool SessionManager::Has(const std::string& id) const { 38 bool SessionManager::Has(const std::string& id) const {
39 base::AutoLock lock(map_lock_); 39 base::AutoLock lock(map_lock_);
40 return map_.find(id) != map_.end(); 40 return map_.find(id) != map_.end();
41 } 41 }
42 42
43 bool SessionManager::Remove(const std::string& id) { 43 bool SessionManager::Remove(const std::string& id) {
44 std::map<std::string, Session*>::iterator it; 44 std::map<std::string, Session*>::iterator it;
45 Session* session; 45 Session* session;
(...skipping 12 matching lines...) Expand all
58 std::map<std::string, Session*>::const_iterator it; 58 std::map<std::string, Session*>::const_iterator it;
59 base::AutoLock lock(map_lock_); 59 base::AutoLock lock(map_lock_);
60 it = map_.find(id); 60 it = map_.find(id);
61 if (it == map_.end()) { 61 if (it == map_.end()) {
62 VLOG(1) << "No such session with ID " << id; 62 VLOG(1) << "No such session with ID " << id;
63 return NULL; 63 return NULL;
64 } 64 }
65 return it->second; 65 return it->second;
66 } 66 }
67 67
68 void SessionManager::set_port(const std::string& port) { 68 void SessionManager::SetPort(const std::string& port) {
69 port_ = port; 69 port_ = port;
70 } 70 }
71 71
72 void SessionManager::set_url_base(const std::string& url_base) { 72 void SessionManager::SetChromeDir(const FilePath& chrome_dir) {
73 chrome_dir_ = chrome_dir;
74 }
75
76 FilePath SessionManager::ChromeDir() const {
77 return chrome_dir_;
78 }
79
80 void SessionManager::SetScreenshotOnError(bool screenshot) {
81 screenshot_on_error_ = screenshot;
82 }
83
84 bool SessionManager::ScreenshotOnError() const {
85 return screenshot_on_error_;
86 }
87
88 void SessionManager::SetUrlBase(const std::string& url_base) {
73 url_base_ = url_base; 89 url_base_ = url_base;
74 } 90 }
75 91
76 std::string SessionManager::url_base() const { 92 std::string SessionManager::UrlBase() const {
77 return url_base_; 93 return url_base_;
78 } 94 }
79 95
80 void SessionManager::set_chrome_dir(const FilePath& chrome_dir) { 96 SessionManager::SessionManager()
81 chrome_dir_ = chrome_dir; 97 : port_(""), url_base_(""), screenshot_on_error_(false) {}
82 }
83
84 FilePath SessionManager::chrome_dir() const {
85 return chrome_dir_;
86 }
87
88 SessionManager::SessionManager() : port_(""), url_base_("") {}
89 98
90 SessionManager::~SessionManager() {} 99 SessionManager::~SessionManager() {}
91 100
92 // static 101 // static
93 SessionManager* SessionManager::GetInstance() { 102 SessionManager* SessionManager::GetInstance() {
94 return Singleton<SessionManager>::get(); 103 return Singleton<SessionManager>::get();
95 } 104 }
96 105
97 } // namespace webdriver 106 } // namespace webdriver
OLDNEW
« chrome/test/webdriver/session.h ('K') | « chrome/test/webdriver/session_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698