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/web_view_impl.h" | 5 #include "chrome/test/chromedriver/chrome/web_view_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/test/chromedriver/chrome/debugger_tracker.h" | 16 #include "chrome/test/chromedriver/chrome/debugger_tracker.h" |
17 #include "chrome/test/chromedriver/chrome/devtools_client_impl.h" | 17 #include "chrome/test/chromedriver/chrome/devtools_client_impl.h" |
18 #include "chrome/test/chromedriver/chrome/dom_tracker.h" | 18 #include "chrome/test/chromedriver/chrome/dom_tracker.h" |
19 #include "chrome/test/chromedriver/chrome/frame_tracker.h" | 19 #include "chrome/test/chromedriver/chrome/frame_tracker.h" |
20 #include "chrome/test/chromedriver/chrome/geolocation_override_manager.h" | 20 #include "chrome/test/chromedriver/chrome/geolocation_override_manager.h" |
21 #include "chrome/test/chromedriver/chrome/heap_snapshot_taker.h" | 21 #include "chrome/test/chromedriver/chrome/heap_snapshot_taker.h" |
22 #include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h" | 22 #include "chrome/test/chromedriver/chrome/javascript_dialog_manager.h" |
23 #include "chrome/test/chromedriver/chrome/js.h" | 23 #include "chrome/test/chromedriver/chrome/js.h" |
| 24 #include "chrome/test/chromedriver/chrome/mobile_emulation_override_manager.h" |
24 #include "chrome/test/chromedriver/chrome/navigation_tracker.h" | 25 #include "chrome/test/chromedriver/chrome/navigation_tracker.h" |
25 #include "chrome/test/chromedriver/chrome/status.h" | 26 #include "chrome/test/chromedriver/chrome/status.h" |
26 #include "chrome/test/chromedriver/chrome/ui_events.h" | 27 #include "chrome/test/chromedriver/chrome/ui_events.h" |
27 #include "chrome/test/chromedriver/chrome/version.h" | 28 #include "chrome/test/chromedriver/chrome/version.h" |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 Status GetContextIdForFrame(FrameTracker* tracker, | 32 Status GetContextIdForFrame(FrameTracker* tracker, |
32 const std::string& frame, | 33 const std::string& frame, |
33 int* context_id) { | 34 int* context_id) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return "char"; | 108 return "char"; |
108 default: | 109 default: |
109 return ""; | 110 return ""; |
110 } | 111 } |
111 } | 112 } |
112 | 113 |
113 } // namespace | 114 } // namespace |
114 | 115 |
115 WebViewImpl::WebViewImpl(const std::string& id, | 116 WebViewImpl::WebViewImpl(const std::string& id, |
116 const BrowserInfo* browser_info, | 117 const BrowserInfo* browser_info, |
117 scoped_ptr<DevToolsClient> client) | 118 scoped_ptr<DevToolsClient> client, |
| 119 const DeviceMetrics* device_metrics) |
118 : id_(id), | 120 : id_(id), |
119 browser_info_(browser_info), | 121 browser_info_(browser_info), |
120 dom_tracker_(new DomTracker(client.get())), | 122 dom_tracker_(new DomTracker(client.get())), |
121 frame_tracker_(new FrameTracker(client.get())), | 123 frame_tracker_(new FrameTracker(client.get())), |
122 navigation_tracker_(new NavigationTracker(client.get(), browser_info)), | 124 navigation_tracker_(new NavigationTracker(client.get(), browser_info)), |
123 dialog_manager_(new JavaScriptDialogManager(client.get())), | 125 dialog_manager_(new JavaScriptDialogManager(client.get())), |
| 126 mobile_emulation_override_manager_( |
| 127 new MobileEmulationOverrideManager(client.get(), device_metrics)), |
124 geolocation_override_manager_( | 128 geolocation_override_manager_( |
125 new GeolocationOverrideManager(client.get())), | 129 new GeolocationOverrideManager(client.get())), |
126 heap_snapshot_taker_(new HeapSnapshotTaker(client.get())), | 130 heap_snapshot_taker_(new HeapSnapshotTaker(client.get())), |
127 debugger_(new DebuggerTracker(client.get())), | 131 debugger_(new DebuggerTracker(client.get())), |
128 client_(client.release()) {} | 132 client_(client.release()) {} |
129 | 133 |
130 WebViewImpl::~WebViewImpl() {} | 134 WebViewImpl::~WebViewImpl() {} |
131 | 135 |
132 std::string WebViewImpl::GetId() { | 136 std::string WebViewImpl::GetId() { |
133 return id_; | 137 return id_; |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if (status.IsError()) | 655 if (status.IsError()) |
652 return status; | 656 return status; |
653 | 657 |
654 if (!cmd_result->GetInteger("nodeId", node_id)) | 658 if (!cmd_result->GetInteger("nodeId", node_id)) |
655 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); | 659 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); |
656 *found_node = true; | 660 *found_node = true; |
657 return Status(kOk); | 661 return Status(kOk); |
658 } | 662 } |
659 | 663 |
660 } // namespace internal | 664 } // namespace internal |
OLD | NEW |