| 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/MockSpellCheck.h" | 11 #include "content/shell/renderer/test_runner/MockSpellCheck.h" |
| 12 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 12 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
| 13 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 13 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
| 14 #include "content/shell/renderer/test_runner/WebTestProxy.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" |
| 24 #include "ui/events/keycodes/keyboard_codes.h" | 24 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 void EventSender::TextZoomOut() { | 1373 void EventSender::TextZoomOut() { |
| 1374 view_->setTextZoomFactor(view_->textZoomFactor() / 1.2f); | 1374 view_->setTextZoomFactor(view_->textZoomFactor() / 1.2f); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 void EventSender::ZoomPageIn() { | 1377 void EventSender::ZoomPageIn() { |
| 1378 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1378 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); |
| 1379 | 1379 |
| 1380 for (size_t i = 0; i < window_list.size(); ++i) { | 1380 for (size_t i = 0; i < window_list.size(); ++i) { |
| 1381 window_list.at(i)->webView()->setZoomLevel( | 1381 window_list.at(i)->GetWebView()->setZoomLevel( |
| 1382 window_list.at(i)->webView()->zoomLevel() + 1); | 1382 window_list.at(i)->GetWebView()->zoomLevel() + 1); |
| 1383 } | 1383 } |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 void EventSender::ZoomPageOut() { | 1386 void EventSender::ZoomPageOut() { |
| 1387 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1387 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); |
| 1388 | 1388 |
| 1389 for (size_t i = 0; i < window_list.size(); ++i) { | 1389 for (size_t i = 0; i < window_list.size(); ++i) { |
| 1390 window_list.at(i)->webView()->setZoomLevel( | 1390 window_list.at(i)->GetWebView()->setZoomLevel( |
| 1391 window_list.at(i)->webView()->zoomLevel() - 1); | 1391 window_list.at(i)->GetWebView()->zoomLevel() - 1); |
| 1392 } | 1392 } |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 void EventSender::SetPageZoomFactor(double zoom_factor) { | 1395 void EventSender::SetPageZoomFactor(double zoom_factor) { |
| 1396 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); | 1396 const std::vector<WebTestProxyBase*>& window_list = interfaces_->windowList(); |
| 1397 | 1397 |
| 1398 for (size_t i = 0; i < window_list.size(); ++i) { | 1398 for (size_t i = 0; i < window_list.size(); ++i) { |
| 1399 window_list.at(i)->webView()->setZoomLevel( | 1399 window_list.at(i)->GetWebView()->setZoomLevel( |
| 1400 ZoomFactorToZoomLevel(zoom_factor)); | 1400 ZoomFactorToZoomLevel(zoom_factor)); |
| 1401 } | 1401 } |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { | 1404 void EventSender::SetPageScaleFactor(float scale_factor, int x, int y) { |
| 1405 view_->setPageScaleFactorLimits(scale_factor, scale_factor); | 1405 view_->setPageScaleFactorLimits(scale_factor, scale_factor); |
| 1406 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); | 1406 view_->setPageScaleFactor(scale_factor, WebPoint(x, y)); |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 void EventSender::ClearTouchPoints() { | 1409 void EventSender::ClearTouchPoints() { |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 } | 2166 } |
| 2167 default: | 2167 default: |
| 2168 NOTREACHED(); | 2168 NOTREACHED(); |
| 2169 } | 2169 } |
| 2170 } | 2170 } |
| 2171 | 2171 |
| 2172 replaying_saved_events_ = false; | 2172 replaying_saved_events_ = false; |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 } // namespace content | 2175 } // namespace content |
| OLD | NEW |