| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_H_ | |
| 6 #define CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class DictionaryValue; | |
| 15 } | |
| 16 | |
| 17 class DevToolsEventListener; | |
| 18 class Status; | |
| 19 | |
| 20 // A DevTools client of a single DevTools debugger. | |
| 21 class DevToolsClient { | |
| 22 public: | |
| 23 typedef base::Callback<Status(bool* is_condition_met)> ConditionalFunc; | |
| 24 | |
| 25 virtual ~DevToolsClient() {} | |
| 26 | |
| 27 // Connect to DevTools if the DevToolsClient is disconnected. | |
| 28 virtual Status ConnectIfNecessary() = 0; | |
| 29 | |
| 30 virtual Status SendCommand(const std::string& method, | |
| 31 const base::DictionaryValue& params) = 0; | |
| 32 virtual Status SendCommandAndGetResult( | |
| 33 const std::string& method, | |
| 34 const base::DictionaryValue& params, | |
| 35 scoped_ptr<base::DictionaryValue>* result) = 0; | |
| 36 | |
| 37 virtual void AddListener(DevToolsEventListener* listener) = 0; | |
| 38 | |
| 39 // Handles events until the given function reports the condition is met | |
| 40 // and there are no more received events to handle. If the given | |
| 41 // function ever returns an error, returns immediately with the error. | |
| 42 virtual Status HandleEventsUntil(const ConditionalFunc& conditional_func) = 0; | |
| 43 | |
| 44 // Handles events that have been received but not yet handled. | |
| 45 virtual Status HandleReceivedEvents(); | |
| 46 }; | |
| 47 | |
| 48 #endif // CHROME_TEST_CHROMEDRIVER_DEVTOOLS_CLIENT_H_ | |
| OLD | NEW |