Chromium Code Reviews| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 detach(false), | 50 detach(false), |
| 51 force_devtools_screenshot(false), | 51 force_devtools_screenshot(false), |
| 52 chrome(std::move(chrome)), | 52 chrome(std::move(chrome)), |
| 53 sticky_modifiers(0), | 53 sticky_modifiers(0), |
| 54 mouse_position(0, 0), | 54 mouse_position(0, 0), |
| 55 page_load_timeout(kDefaultPageLoadTimeout), | 55 page_load_timeout(kDefaultPageLoadTimeout), |
| 56 auto_reporting_enabled(false) {} | 56 auto_reporting_enabled(false) {} |
| 57 | 57 |
| 58 Session::~Session() {} | 58 Session::~Session() {} |
| 59 | 59 |
| 60 //types of unexpected alert behaviour | |
| 61 const char Session::kAccept[] = "accept"; | |
| 62 const char Session::kDismiss[] = "dismiss"; | |
| 63 const char Session::kIgnore[] = "ignore"; | |
| 64 | |
| 65 std::string Session::GetUnexpectedAlertBehaviour() const { | |
| 66 if (unexpected_alert_behaviour.empty()) | |
|
samuong
2016/11/22 19:52:16
is it possible for this to ever be set to the empt
gmanikpure
2016/11/23 18:34:26
Empty string can be set in DesiredCapabilities "dc
samuong
2016/11/23 21:28:01
There's no need for the "get_" prefix for this fun
gmanikpure
2016/11/23 22:04:10
Actually, I was getting multiple 'duplicate member
samuong
2016/11/23 22:11:00
Oh, I just realized that Session is a struct and n
gmanikpure
2016/11/23 22:24:31
Hmm, yeah. I missed noticing that, thanks for poin
| |
| 67 return Session::kIgnore; | |
| 68 else | |
| 69 return unexpected_alert_behaviour; | |
| 70 } | |
| 71 | |
| 60 Status Session::GetTargetWindow(WebView** web_view) { | 72 Status Session::GetTargetWindow(WebView** web_view) { |
| 61 if (!chrome) | 73 if (!chrome) |
| 62 return Status(kNoSuchWindow, "no chrome started in this session"); | 74 return Status(kNoSuchWindow, "no chrome started in this session"); |
| 63 | 75 |
| 64 Status status = chrome->GetWebViewById(window, web_view); | 76 Status status = chrome->GetWebViewById(window, web_view); |
| 65 if (status.IsError()) | 77 if (status.IsError()) |
| 66 status = Status(kNoSuchWindow, "target window already closed", status); | 78 status = Status(kNoSuchWindow, "target window already closed", status); |
| 67 return status; | 79 return status; |
| 68 } | 80 } |
| 69 | 81 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 return std::string(); | 127 return std::string(); |
| 116 } | 128 } |
| 117 | 129 |
| 118 Session* GetThreadLocalSession() { | 130 Session* GetThreadLocalSession() { |
| 119 return lazy_tls_session.Pointer()->Get(); | 131 return lazy_tls_session.Pointer()->Get(); |
| 120 } | 132 } |
| 121 | 133 |
| 122 void SetThreadLocalSession(std::unique_ptr<Session> session) { | 134 void SetThreadLocalSession(std::unique_ptr<Session> session) { |
| 123 lazy_tls_session.Pointer()->Set(session.release()); | 135 lazy_tls_session.Pointer()->Set(session.release()); |
| 124 } | 136 } |
| OLD | NEW |