| 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 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_IMPL_H_ | 5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_IMPL_H_ |
| 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_IMPL_H_ | 6 #define CHROME_TEST_CHROMEDRIVER_CHROME_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/process.h" | 15 #include "base/process.h" |
| 16 #include "chrome/test/chromedriver/chrome.h" | 16 #include "chrome/test/chromedriver/chrome.h" |
| 17 #include "chrome/test/chromedriver/net/sync_websocket_factory.h" | 17 #include "chrome/test/chromedriver/net/sync_websocket_factory.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class DictionaryValue; |
| 20 class ListValue; | 21 class ListValue; |
| 21 class Value; | 22 class Value; |
| 22 } | 23 } |
| 23 | 24 |
| 24 class DevToolsClient; | 25 class DevToolsClient; |
| 26 class DomTracker; |
| 25 class Status; | 27 class Status; |
| 26 class URLRequestContextGetter; | 28 class URLRequestContextGetter; |
| 27 | 29 |
| 28 class ChromeImpl : public Chrome { | 30 class ChromeImpl : public Chrome { |
| 29 public: | 31 public: |
| 30 ChromeImpl(base::ProcessHandle process, | 32 ChromeImpl(base::ProcessHandle process, |
| 31 URLRequestContextGetter* context_getter, | 33 URLRequestContextGetter* context_getter, |
| 32 base::ScopedTempDir* user_data_dir, | 34 base::ScopedTempDir* user_data_dir, |
| 33 int port, | 35 int port, |
| 34 const SyncWebSocketFactory& socket_factory); | 36 const SyncWebSocketFactory& socket_factory); |
| 35 virtual ~ChromeImpl(); | 37 virtual ~ChromeImpl(); |
| 36 | 38 |
| 37 Status Init(); | 39 Status Init(); |
| 38 | 40 |
| 39 // Overridden from Chrome: | 41 // Overridden from Chrome: |
| 40 virtual Status Load(const std::string& url) OVERRIDE; | 42 virtual Status Load(const std::string& url) OVERRIDE; |
| 41 virtual Status EvaluateScript(const std::string& expression, | 43 virtual Status EvaluateScript(const std::string& frame, |
| 44 const std::string& expression, |
| 42 scoped_ptr<base::Value>* result) OVERRIDE; | 45 scoped_ptr<base::Value>* result) OVERRIDE; |
| 43 virtual Status CallFunction(const std::string& function, | 46 virtual Status CallFunction(const std::string& frame, |
| 47 const std::string& function, |
| 44 const base::ListValue& args, | 48 const base::ListValue& args, |
| 45 scoped_ptr<base::Value>* result) OVERRIDE; | 49 scoped_ptr<base::Value>* result) OVERRIDE; |
| 50 virtual Status GetFrameByFunction(const std::string& frame, |
| 51 const std::string& function, |
| 52 const base::ListValue& args, |
| 53 std::string* out_frame) OVERRIDE; |
| 46 virtual Status Quit() OVERRIDE; | 54 virtual Status Quit() OVERRIDE; |
| 47 | 55 |
| 48 private: | 56 private: |
| 49 base::ProcessHandle process_; | 57 base::ProcessHandle process_; |
| 50 scoped_refptr<URLRequestContextGetter> context_getter_; | 58 scoped_refptr<URLRequestContextGetter> context_getter_; |
| 51 base::ScopedTempDir user_data_dir_; | 59 base::ScopedTempDir user_data_dir_; |
| 52 int port_; | 60 int port_; |
| 53 SyncWebSocketFactory socket_factory_; | 61 SyncWebSocketFactory socket_factory_; |
| 62 scoped_ptr<DomTracker> dom_tracker_; |
| 54 scoped_ptr<DevToolsClient> client_; | 63 scoped_ptr<DevToolsClient> client_; |
| 55 }; | 64 }; |
| 56 | 65 |
| 57 namespace internal { | 66 namespace internal { |
| 58 | 67 |
| 59 Status ParsePagesInfo(const std::string& data, | 68 Status ParsePagesInfo(const std::string& data, |
| 60 std::list<std::string>* debugger_urls); | 69 std::list<std::string>* debugger_urls); |
| 70 enum EvaluateScriptReturnType { |
| 71 ReturnByValue, |
| 72 ReturnByObject |
| 73 }; |
| 61 Status EvaluateScript(DevToolsClient* client, | 74 Status EvaluateScript(DevToolsClient* client, |
| 75 int context_id, |
| 62 const std::string& expression, | 76 const std::string& expression, |
| 63 scoped_ptr<base::Value>* result); | 77 EvaluateScriptReturnType return_type, |
| 78 scoped_ptr<base::DictionaryValue>* result); |
| 79 Status EvaluateScriptAndGetObject(DevToolsClient* client, |
| 80 int context_id, |
| 81 const std::string& expression, |
| 82 std::string* object_id); |
| 83 Status EvaluateScriptAndGetValue(DevToolsClient* client, |
| 84 int context_id, |
| 85 const std::string& expression, |
| 86 scoped_ptr<base::Value>* result); |
| 87 Status GetNodeIdFromFunction(DevToolsClient* client, |
| 88 int context_id, |
| 89 const std::string& function, |
| 90 const base::ListValue& args, |
| 91 int* node_id); |
| 64 | 92 |
| 65 } // namespace internal | 93 } // namespace internal |
| 66 | 94 |
| 67 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_IMPL_H_ | 95 #endif // CHROME_TEST_CHROMEDRIVER_CHROME_IMPL_H_ |
| OLD | NEW |