OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/renderer/test_runner/event_sender.h" | 5 #include "content/shell/renderer/test_runner/event_sender.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/public/common/page_zoom.h" | 10 #include "content/public/common/page_zoom.h" |
11 #include "content/shell/renderer/test_runner/TestInterfaces.h" | |
12 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 11 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
13 #include "content/shell/renderer/test_runner/mock_spell_check.h" | 12 #include "content/shell/renderer/test_runner/mock_spell_check.h" |
| 13 #include "content/shell/renderer/test_runner/test_interfaces.h" |
14 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 14 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
15 #include "gin/handle.h" | 15 #include "gin/handle.h" |
16 #include "gin/object_template_builder.h" | 16 #include "gin/object_template_builder.h" |
17 #include "gin/wrappable.h" | 17 #include "gin/wrappable.h" |
18 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
19 #include "third_party/WebKit/public/platform/WebVector.h" | 19 #include "third_party/WebKit/public/platform/WebVector.h" |
20 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 20 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
21 #include "third_party/WebKit/public/web/WebFrame.h" | 21 #include "third_party/WebKit/public/web/WebFrame.h" |
22 #include "third_party/WebKit/public/web/WebKit.h" | 22 #include "third_party/WebKit/public/web/WebKit.h" |
23 #include "third_party/WebKit/public/web/WebView.h" | 23 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 | 1419 |
1420 void EventSender::TextZoomIn() { | 1420 void EventSender::TextZoomIn() { |
1421 view_->setTextZoomFactor(view_->textZoomFactor() * 1.2f); | 1421 view_->setTextZoomFactor(view_->textZoomFactor() * 1.2f); |
1422 } | 1422 } |
1423 | 1423 |
1424 void EventSender::TextZoomOut() { | 1424 void EventSender::TextZoomOut() { |
1425 view_->setTextZoomFactor(view_->textZoomFactor() / 1.2f); | 1425 view_->setTextZoomFactor(view_->textZoomFactor() / 1.2f); |
1426 } | 1426 } |
1427 | 1427 |
1428 void EventSender::ZoomPageIn() { | 1428 void EventSender::ZoomPageIn() { |
1429 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1429 const std::vector<WebTestProxyBase*>& window_list = |
| 1430 interfaces_->GetWindowList(); |
1430 | 1431 |
1431 for (size_t i = 0; i < window_list.size(); ++i) { | 1432 for (size_t i = 0; i < window_list.size(); ++i) { |
1432 window_list.at(i)->GetWebView()->setZoomLevel( | 1433 window_list.at(i)->GetWebView()->setZoomLevel( |
1433 window_list.at(i)->GetWebView()->zoomLevel() + 1); | 1434 window_list.at(i)->GetWebView()->zoomLevel() + 1); |
1434 } | 1435 } |
1435 } | 1436 } |
1436 | 1437 |
1437 void EventSender::ZoomPageOut() { | 1438 void EventSender::ZoomPageOut() { |
1438 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1439 const std::vector<WebTestProxyBase*>& window_list = |
| 1440 interfaces_->GetWindowList(); |
1439 | 1441 |
1440 for (size_t i = 0; i < window_list.size(); ++i) { | 1442 for (size_t i = 0; i < window_list.size(); ++i) { |
1441 window_list.at(i)->GetWebView()->setZoomLevel( | 1443 window_list.at(i)->GetWebView()->setZoomLevel( |
1442 window_list.at(i)->GetWebView()->zoomLevel() - 1); | 1444 window_list.at(i)->GetWebView()->zoomLevel() - 1); |
1443 } | 1445 } |
1444 } | 1446 } |
1445 | 1447 |
1446 void EventSender::SetPageZoomFactor(double zoom_factor) { | 1448 void EventSender::SetPageZoomFactor(double zoom_factor) { |
1447 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1449 const std::vector<WebTestProxyBase*>& window_list = |
| 1450 interfaces_->GetWindowList(); |
1448 | 1451 |
1449 for (size_t i = 0; i < window_list.size(); ++i) { | 1452 for (size_t i = 0; i < window_list.size(); ++i) { |
1450 window_list.at(i)->GetWebView()->setZoomLevel( | 1453 window_list.at(i)->GetWebView()->setZoomLevel( |
1451 ZoomFactorToZoomLevel(zoom_factor)); | 1454 ZoomFactorToZoomLevel(zoom_factor)); |
1452 } | 1455 } |
1453 } | 1456 } |
1454 | 1457 |
1455 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { | 1458 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { |
1456 view_->setPageScaleFactorLimits(scale_factor, scale_factor); | 1459 view_->setPageScaleFactorLimits(scale_factor, scale_factor); |
1457 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); | 1460 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 } | 2284 } |
2282 default: | 2285 default: |
2283 NOTREACHED(); | 2286 NOTREACHED(); |
2284 } | 2287 } |
2285 } | 2288 } |
2286 | 2289 |
2287 replaying_saved_events_ = false; | 2290 replaying_saved_events_ = false; |
2288 } | 2291 } |
2289 | 2292 |
2290 } // namespace content | 2293 } // namespace content |
OLD | NEW |