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/chrome_impl.h" | 5 #include "chrome/test/chromedriver/chrome_impl.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 while (base::Time::Now() < deadline) { | 74 while (base::Time::Now() < deadline) { |
75 FetchPagesInfo(context_getter_, port_, &debugger_urls); | 75 FetchPagesInfo(context_getter_, port_, &debugger_urls); |
76 if (debugger_urls.empty()) | 76 if (debugger_urls.empty()) |
77 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 77 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
78 else | 78 else |
79 break; | 79 break; |
80 } | 80 } |
81 if (debugger_urls.empty()) | 81 if (debugger_urls.empty()) |
82 return Status(kUnknownError, "unable to discover open pages"); | 82 return Status(kUnknownError, "unable to discover open pages"); |
83 client_.reset(new DevToolsClientImpl( | 83 client_.reset(new DevToolsClientImpl( |
84 socket_factory_, debugger_urls.front(), dom_tracker_.get())); | 84 socket_factory_, debugger_urls.front())); |
| 85 client_->AddListener(dom_tracker_.get()); |
85 | 86 |
86 // Perform necessary configuration of the DevTools client. | 87 // Perform necessary configuration of the DevTools client. |
87 // Fetch the root document node so that Inspector will push DOM node | 88 // Fetch the root document node so that Inspector will push DOM node |
88 // information to the client. | 89 // information to the client. |
89 base::DictionaryValue params; | 90 base::DictionaryValue params; |
90 Status status = client_->SendCommand("DOM.getDocument", params); | 91 Status status = client_->SendCommand("DOM.getDocument", params); |
91 if (status.IsError()) | 92 if (status.IsError()) |
92 return status; | 93 return status; |
93 // Enable runtime events to allow tracking execution context creation. | 94 // Enable runtime events to allow tracking execution context creation. |
94 return client_->SendCommand("Runtime.enable", params); | 95 return client_->SendCommand("Runtime.enable", params); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 293 } |
293 if (status.IsError()) | 294 if (status.IsError()) |
294 return status; | 295 return status; |
295 | 296 |
296 if (!cmd_result->GetInteger("nodeId", node_id)) | 297 if (!cmd_result->GetInteger("nodeId", node_id)) |
297 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); | 298 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); |
298 return Status(kOk); | 299 return Status(kOk); |
299 } | 300 } |
300 | 301 |
301 } // namespace internal | 302 } // namespace internal |
OLD | NEW |