1d0825bca7fe65beaee391d30da42e937db621564Steve Block/* 2d0825bca7fe65beaee391d30da42e937db621564Steve Block * Copyright (C) 2010 Apple Inc. All rights reserved. 3d0825bca7fe65beaee391d30da42e937db621564Steve Block * 4d0825bca7fe65beaee391d30da42e937db621564Steve Block * Redistribution and use in source and binary forms, with or without 5d0825bca7fe65beaee391d30da42e937db621564Steve Block * modification, are permitted provided that the following conditions 6d0825bca7fe65beaee391d30da42e937db621564Steve Block * are met: 7d0825bca7fe65beaee391d30da42e937db621564Steve Block * 1. Redistributions of source code must retain the above copyright 8d0825bca7fe65beaee391d30da42e937db621564Steve Block * notice, this list of conditions and the following disclaimer. 9d0825bca7fe65beaee391d30da42e937db621564Steve Block * 2. Redistributions in binary form must reproduce the above copyright 10d0825bca7fe65beaee391d30da42e937db621564Steve Block * notice, this list of conditions and the following disclaimer in the 11d0825bca7fe65beaee391d30da42e937db621564Steve Block * documentation and/or other materials provided with the distribution. 12d0825bca7fe65beaee391d30da42e937db621564Steve Block * 13d0825bca7fe65beaee391d30da42e937db621564Steve Block * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14d0825bca7fe65beaee391d30da42e937db621564Steve Block * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15d0825bca7fe65beaee391d30da42e937db621564Steve Block * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16d0825bca7fe65beaee391d30da42e937db621564Steve Block * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17d0825bca7fe65beaee391d30da42e937db621564Steve Block * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18d0825bca7fe65beaee391d30da42e937db621564Steve Block * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19d0825bca7fe65beaee391d30da42e937db621564Steve Block * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20d0825bca7fe65beaee391d30da42e937db621564Steve Block * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21d0825bca7fe65beaee391d30da42e937db621564Steve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22d0825bca7fe65beaee391d30da42e937db621564Steve Block * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23d0825bca7fe65beaee391d30da42e937db621564Steve Block */ 24d0825bca7fe65beaee391d30da42e937db621564Steve Block 25d0825bca7fe65beaee391d30da42e937db621564Steve Block#ifndef TestsController_h 26d0825bca7fe65beaee391d30da42e937db621564Steve Block#define TestsController_h 27d0825bca7fe65beaee391d30da42e937db621564Steve Block 28d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <windows.h> 29d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <wtf/Forward.h> 30d0825bca7fe65beaee391d30da42e937db621564Steve Block#include <wtf/Deque.h> 31d0825bca7fe65beaee391d30da42e937db621564Steve Block 32d0825bca7fe65beaee391d30da42e937db621564Steve Blocknamespace WebKitAPITest { 33d0825bca7fe65beaee391d30da42e937db621564Steve Block 34d0825bca7fe65beaee391d30da42e937db621564Steve Blockclass Test; 35d0825bca7fe65beaee391d30da42e937db621564Steve Block 36ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdochclass TestsController { 37ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch WTF_MAKE_NONCOPYABLE(TestsController); 38d0825bca7fe65beaee391d30da42e937db621564Steve Blockpublic: 39d0825bca7fe65beaee391d30da42e937db621564Steve Block static TestsController& shared(); 40d0825bca7fe65beaee391d30da42e937db621564Steve Block 41d0825bca7fe65beaee391d30da42e937db621564Steve Block // Returns true if all the tests passed, false otherwise. 42d0825bca7fe65beaee391d30da42e937db621564Steve Block bool runAllTests(); 43d0825bca7fe65beaee391d30da42e937db621564Steve Block 44d0825bca7fe65beaee391d30da42e937db621564Steve Block void addTest(PassOwnPtr<Test>); 45d0825bca7fe65beaee391d30da42e937db621564Steve Block void testFailed(const char* file, int line, const char* message); 46d0825bca7fe65beaee391d30da42e937db621564Steve Block 47d0825bca7fe65beaee391d30da42e937db621564Steve Blockprivate: 48d0825bca7fe65beaee391d30da42e937db621564Steve Block TestsController(); 49d0825bca7fe65beaee391d30da42e937db621564Steve Block ~TestsController(); 50d0825bca7fe65beaee391d30da42e937db621564Steve Block 51d0825bca7fe65beaee391d30da42e937db621564Steve Block void runNextTest(); 52d0825bca7fe65beaee391d30da42e937db621564Steve Block void runNextTestSoon(); 53d0825bca7fe65beaee391d30da42e937db621564Steve Block 54d0825bca7fe65beaee391d30da42e937db621564Steve Block static void registerWindowClass(); 55d0825bca7fe65beaee391d30da42e937db621564Steve Block static LRESULT CALLBACK wndProc(HWND, UINT uMsg, WPARAM, LPARAM); 56d0825bca7fe65beaee391d30da42e937db621564Steve Block 57d0825bca7fe65beaee391d30da42e937db621564Steve Block HWND m_window; 58d0825bca7fe65beaee391d30da42e937db621564Steve Block Deque<Test*> m_tests; 59d0825bca7fe65beaee391d30da42e937db621564Steve Block bool m_testFailed; 60d0825bca7fe65beaee391d30da42e937db621564Steve Block bool m_anyTestFailed; 61d0825bca7fe65beaee391d30da42e937db621564Steve Block}; 62d0825bca7fe65beaee391d30da42e937db621564Steve Block 63d0825bca7fe65beaee391d30da42e937db621564Steve Block} // namespace WebKitAPITest 64d0825bca7fe65beaee391d30da42e937db621564Steve Block 65d0825bca7fe65beaee391d30da42e937db621564Steve Block#endif // TestsController_h 66