18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 2dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * Copyright (C) 2010 Google Inc. All rights reserved. 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met: 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer. 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution. 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 255af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 26dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include "config.h" 27dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include "WebDeviceOrientationClientMock.h" 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 29dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include "DeviceOrientationClientMock.h" 30dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include "WebDeviceOrientation.h" 31dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include "WebDeviceOrientationController.h" 32545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch 33dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochnamespace WebKit { 34545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch 3568513a70bcd92384395513322f1b801e7bf9c729Steve BlockWebDeviceOrientationClientMock* WebDeviceOrientationClientMock::create() 3668513a70bcd92384395513322f1b801e7bf9c729Steve Block{ 3768513a70bcd92384395513322f1b801e7bf9c729Steve Block return new WebDeviceOrientationClientMock(); 3868513a70bcd92384395513322f1b801e7bf9c729Steve Block} 3968513a70bcd92384395513322f1b801e7bf9c729Steve Block 40dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid WebDeviceOrientationClientMock::setController(WebDeviceOrientationController* controller) 41dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 42dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch m_clientMock->setController(controller->controller()); 435abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick delete controller; 44dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 45dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 46dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid WebDeviceOrientationClientMock::startUpdating() 47dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 48dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch m_clientMock->startUpdating(); 49dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 50dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 51dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid WebDeviceOrientationClientMock::stopUpdating() 52dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 53dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch m_clientMock->stopUpdating(); 54dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 55dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 56dd8bb3de4f353a81954234999f1fea748aee2ea9Ben MurdochWebDeviceOrientation WebDeviceOrientationClientMock::lastOrientation() const 57dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 58dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return WebDeviceOrientation(m_clientMock->lastOrientation()); 59dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 60dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 61dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid WebDeviceOrientationClientMock::setOrientation(WebDeviceOrientation& orientation) 62dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 63dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch m_clientMock->setOrientation(orientation); 64dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 66dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid WebDeviceOrientationClientMock::initialize() 67dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 685abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick m_clientMock.reset(new WebCore::DeviceOrientationClientMock()); 69dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 70dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 71dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid WebDeviceOrientationClientMock::reset() 72dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 735abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick m_clientMock.reset(0); 74dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 75dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 76dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} // namespace WebKit 77