| 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 = interfaces_->WindowList(); |
| 1430 | 1430 |
| 1431 for (size_t i = 0; i < window_list.size(); ++i) { | 1431 for (size_t i = 0; i < window_list.size(); ++i) { |
| 1432 window_list.at(i)->GetWebView()->setZoomLevel( | 1432 window_list.at(i)->GetWebView()->setZoomLevel( |
| 1433 window_list.at(i)->GetWebView()->zoomLevel() + 1); | 1433 window_list.at(i)->GetWebView()->zoomLevel() + 1); |
| 1434 } | 1434 } |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 void EventSender::ZoomPageOut() { | 1437 void EventSender::ZoomPageOut() { |
| 1438 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1438 const std::vector<WebTestProxyBase*>& window_list = interfaces_->WindowList(); |
| 1439 | 1439 |
| 1440 for (size_t i = 0; i < window_list.size(); ++i) { | 1440 for (size_t i = 0; i < window_list.size(); ++i) { |
| 1441 window_list.at(i)->GetWebView()->setZoomLevel( | 1441 window_list.at(i)->GetWebView()->setZoomLevel( |
| 1442 window_list.at(i)->GetWebView()->zoomLevel() - 1); | 1442 window_list.at(i)->GetWebView()->zoomLevel() - 1); |
| 1443 } | 1443 } |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 void EventSender::SetPageZoomFactor(double zoom_factor) { | 1446 void EventSender::SetPageZoomFactor(double zoom_factor) { |
| 1447 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1447 const std::vector<WebTestProxyBase*>& window_list = interfaces_->WindowList(); |
| 1448 | 1448 |
| 1449 for (size_t i = 0; i < window_list.size(); ++i) { | 1449 for (size_t i = 0; i < window_list.size(); ++i) { |
| 1450 window_list.at(i)->GetWebView()->setZoomLevel( | 1450 window_list.at(i)->GetWebView()->setZoomLevel( |
| 1451 ZoomFactorToZoomLevel(zoom_factor)); | 1451 ZoomFactorToZoomLevel(zoom_factor)); |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { | 1455 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { |
| 1456 view_->setPageScaleFactorLimits(scale_factor, scale_factor); | 1456 view_->setPageScaleFactorLimits(scale_factor, scale_factor); |
| 1457 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); | 1457 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 } | 2281 } |
| 2282 default: | 2282 default: |
| 2283 NOTREACHED(); | 2283 NOTREACHED(); |
| 2284 } | 2284 } |
| 2285 } | 2285 } |
| 2286 | 2286 |
| 2287 replaying_saved_events_ = false; | 2287 replaying_saved_events_ = false; |
| 2288 } | 2288 } |
| 2289 | 2289 |
| 2290 } // namespace content | 2290 } // namespace content |
| OLD | NEW |