OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chrome/devtools_http_client.h" | 5 #include "chrome/test/chromedriver/chrome/devtools_http_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 scoped_ptr<WebViewImpl> web_view(new WebViewImpl(*it, client.Pass())); | 162 scoped_ptr<WebViewImpl> web_view(new WebViewImpl(*it, client.Pass())); |
163 | 163 |
164 status = web_view->ConnectIfNecessary(); | 164 status = web_view->ConnectIfNecessary(); |
165 // Ignore disconnected error, because the debugger might have closed when | 165 // Ignore disconnected error, because the debugger might have closed when |
166 // its container page was closed above. | 166 // its container page was closed above. |
167 if (status.IsError() && status.code() != kDisconnected) | 167 if (status.IsError() && status.code() != kDisconnected) |
168 return status; | 168 return status; |
169 | 169 |
170 scoped_ptr<base::Value> result; | 170 scoped_ptr<base::Value> result; |
171 status = web_view->EvaluateScript( | 171 status = web_view->EvaluateScript( |
172 "", "document.querySelector('*[id^=\"close-button-\"').click();", | 172 std::string(), |
| 173 "document.querySelector('*[id^=\"close-button-\"').click();", |
173 &result); | 174 &result); |
174 // Ignore disconnected error, because it may be closed already. | 175 // Ignore disconnected error, because it may be closed already. |
175 if (status.IsError() && status.code() != kDisconnected) | 176 if (status.IsError() && status.code() != kDisconnected) |
176 return status; | 177 return status; |
177 } | 178 } |
178 | 179 |
179 // Wait until DevTools UI disconnects from the given web view. | 180 // Wait until DevTools UI disconnects from the given web view. |
180 base::Time deadline = base::Time::Now() + base::TimeDelta::FromSeconds(20); | 181 base::Time deadline = base::Time::Now() + base::TimeDelta::FromSeconds(20); |
181 while (base::Time::Now() < deadline) { | 182 while (base::Time::Now() < deadline) { |
182 status = GetWebViewsInfo(&views_info); | 183 status = GetWebViewsInfo(&views_info); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if (!dict->GetString("Browser", version)) { | 248 if (!dict->GetString("Browser", version)) { |
248 return Status( | 249 return Status( |
249 kUnknownError, | 250 kUnknownError, |
250 "Chrome version must be >= " + GetMinimumSupportedChromeVersion(), | 251 "Chrome version must be >= " + GetMinimumSupportedChromeVersion(), |
251 Status(kUnknownError, "version info doesn't include string 'Browser'")); | 252 Status(kUnknownError, "version info doesn't include string 'Browser'")); |
252 } | 253 } |
253 return Status(kOk); | 254 return Status(kOk); |
254 } | 255 } |
255 | 256 |
256 } // namespace internal | 257 } // namespace internal |
OLD | NEW |