View | Details | Raw Unified | Return to bug 90968 | Differences between
and this patch

Collapse All | Expand All

(-)a/Tools/ChangeLog (+63 lines)
Lines 1-3 Link Here
1
2012-11-20  János Badics  <jbadics@inf.u-szeged.hu>
2
3
        [Qt][NRWT] Pass --timeout to DRT/WTR if a test is marked as SLOW.
4
        https://bugs.webkit.org/show_bug.cgi?id=90968.
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Added functionality in DRT and WTR to use any timeout value while running
9
        slow tests (eventually, any test). Now NRWT --time-out-ms determines the
10
        timeout value for the test. Added a flag in NRWT (supports_per_test_timeout)
11
        to indicate whether the current port supports setting timeout value
12
        per test (it's False by default; I enabled it only on Qt).
13
        Also corrected a typo in driver.py
14
15
        * DumpRenderTree/DumpRenderTree.h:
16
        (TestCommand::TestCommand):
17
        (TestCommand):
18
        * DumpRenderTree/DumpRenderTreeCommon.cpp:
19
        (parseInputLine):
20
        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
21
        (WebCore::DumpRenderTree::processLine):
22
        (WebCore::DumpRenderTree::setTimeout):
23
        * DumpRenderTree/qt/DumpRenderTreeQt.h:
24
        (DumpRenderTree):
25
        * Scripts/webkitpy/layout_tests/port/base.py:
26
        (Port.supports_per_test_timeout):
27
        * Scripts/webkitpy/layout_tests/port/driver.py:
28
        (Driver.run_test):
29
        (Driver._command_from_driver_input):
30
        * Scripts/webkitpy/layout_tests/port/qt.py:
31
        (QtPort.supports_per_test_timeout):
32
        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
33
        (WTR::InjectedBundle::InjectedBundle):
34
        (WTR::InjectedBundle::didReceiveMessage):
35
        (WTR::InjectedBundle::beginTesting):
36
        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
37
        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
38
        (WTR::TestRunner::setCustomTimeout):
39
        (WTR):
40
        * WebKitTestRunner/InjectedBundle/TestRunner.h:
41
        (TestRunner):
42
        * WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp:
43
        (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded):
44
        * WebKitTestRunner/TestController.cpp:
45
        (WTR::TestController::TestController):
46
        (WTR::TestController::getCustomTimeout):
47
        (WTR):
48
        (WTR::TestCommand::TestCommand):
49
        (TestCommand):
50
        (WTR::parseInputLine):
51
        (WTR::TestController::runTest):
52
        * WebKitTestRunner/TestController.h:
53
        (TestController):
54
        * WebKitTestRunner/TestInvocation.cpp:
55
        (WTR::TestInvocation::TestInvocation):
56
        (WTR::TestInvocation::setCustomTimeout):
57
        (WTR):
58
        (WTR::TestInvocation::invoke):
59
        * WebKitTestRunner/TestInvocation.h:
60
        (TestInvocation):
61
        * WebKitTestRunner/qt/TestControllerQt.cpp:
62
        (WTR::TestController::platformRunUntil):
63
1
2012-11-20  Zan Dobersek  <zandobersek@gmail.com>
64
2012-11-20  Zan Dobersek  <zandobersek@gmail.com>
2
65
3
        webkitpy unit tests should run serially when checking code coverage
66
        webkitpy unit tests should run serially when checking code coverage
(-)a/Tools/DumpRenderTree/DumpRenderTree.h (-1 / +2 lines)
Lines 66-76 void dump(); Link Here
66
void displayWebView();
66
void displayWebView();
67
67
68
struct TestCommand {
68
struct TestCommand {
69
    TestCommand() : shouldDumpPixels(false) { }
69
    TestCommand() : shouldDumpPixels(false), timeout(30000) { }
70
70
71
    std::string pathOrURL;
71
    std::string pathOrURL;
72
    bool shouldDumpPixels;
72
    bool shouldDumpPixels;
73
    std::string expectedPixelHash;
73
    std::string expectedPixelHash;
74
    double timeout; // in ms
74
};
75
};
75
76
76
TestCommand parseInputLine(const std::string&);
77
TestCommand parseInputLine(const std::string&);
(-)a/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp (-10 / +13 lines)
Lines 66-82 TestCommand parseInputLine(const std::string& inputLine) Link Here
66
    if (!tokenizer.hasNext())
66
    if (!tokenizer.hasNext())
67
        die(inputLine);
67
        die(inputLine);
68
68
69
    result.pathOrURL = tokenizer.next();
70
    if (!tokenizer.hasNext())
71
        return result;
72
73
    std::string arg = tokenizer.next();
69
    std::string arg = tokenizer.next();
74
    if (arg != std::string("-p") && arg != std::string("--pixel-test"))
70
    result.pathOrURL = arg;
75
        die(inputLine);
71
    while (tokenizer.hasNext()) {
76
    result.shouldDumpPixels = true;
72
        arg = tokenizer.next();
77
73
        if (arg == std::string("--timeout")) {
78
    if (tokenizer.hasNext())
74
            std::string timeoutToken = tokenizer.next();
79
        result.expectedPixelHash = tokenizer.next();
75
            result.timeout = atoi(timeoutToken.c_str());
76
        } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) {
77
            result.shouldDumpPixels = true;
78
            if (tokenizer.hasNext())
79
                result.expectedPixelHash = tokenizer.next();
80
        } else
81
            die(inputLine);
82
    }
80
83
81
    return result;
84
    return result;
82
}
85
}
(-)a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (-1 / +2 lines)
Lines 721-726 void DumpRenderTree::processLine(const QString &input) Link Here
721
        open(QUrl::fromLocalFile(fi.absoluteFilePath()));
721
        open(QUrl::fromLocalFile(fi.absoluteFilePath()));
722
    }
722
    }
723
723
724
    setTimeout(command.timeout);
724
    fflush(stdout);
725
    fflush(stdout);
725
}
726
}
726
727
Lines 1145-1151 QList<WebPage*> DumpRenderTree::getAllPages() const Link Here
1145
    return pages;
1146
    return pages;
1146
}
1147
}
1147
1148
1148
void DumpRenderTree::setTimeout(int timeout)
1149
void DumpRenderTree::setTimeout(double timeout)
1149
{
1150
{
1150
    m_controller->setTimeout(timeout);
1151
    m_controller->setTimeout(timeout);
1151
}
1152
}
(-)a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h (-1 / +1 lines)
Lines 103-109 public: Link Here
103
    void setRedirectOutputFileName(const QString& fileName) { m_redirectOutputFileName = fileName; }
103
    void setRedirectOutputFileName(const QString& fileName) { m_redirectOutputFileName = fileName; }
104
    void setRedirectErrorFileName(const QString& fileName) { m_redirectErrorFileName = fileName; }
104
    void setRedirectErrorFileName(const QString& fileName) { m_redirectErrorFileName = fileName; }
105
105
106
    void setTimeout(int);
106
    void setTimeout(double);
107
    void setShouldTimeout(bool flag);
107
    void setShouldTimeout(bool flag);
108
    void setShouldDumpPixelsForAllTests() { m_dumpPixelsForAllTests = true; }
108
    void setShouldDumpPixelsForAllTests() { m_dumpPixelsForAllTests = true; }
109
109
(-)a/Tools/Scripts/webkitpy/layout_tests/port/base.py (+3 lines)
Lines 150-155 class Port(object): Link Here
150
    def additional_drt_flag(self):
150
    def additional_drt_flag(self):
151
        return []
151
        return []
152
152
153
    def supports_per_test_timeout(self):
154
        return False
155
153
    def default_pixel_tests(self):
156
    def default_pixel_tests(self):
154
        # FIXME: Disable until they are run by default on build.webkit.org.
157
        # FIXME: Disable until they are run by default on build.webkit.org.
155
        return False
158
        return False
(-)a/Tools/Scripts/webkitpy/layout_tests/port/driver.py (-1 / +3 lines)
Lines 151-157 class Driver(object): Link Here
151
        the driver in an indeterminate state. The upper layers of the program
151
        the driver in an indeterminate state. The upper layers of the program
152
        are responsible for cleaning up and ensuring things are okay.
152
        are responsible for cleaning up and ensuring things are okay.
153
153
154
        Returns a DriverOuput object.
154
        Returns a DriverOutput object.
155
        """
155
        """
156
        start_time = time.time()
156
        start_time = time.time()
157
        self.start(driver_input.should_run_pixel_test, driver_input.args)
157
        self.start(driver_input.should_run_pixel_test, driver_input.args)
Lines 354-359 class Driver(object): Link Here
354
        assert not driver_input.image_hash or driver_input.should_run_pixel_test
354
        assert not driver_input.image_hash or driver_input.should_run_pixel_test
355
355
356
        # ' is the separator between arguments.
356
        # ' is the separator between arguments.
357
        if self._port.supports_per_test_timeout():
358
            command += "'--timeout'%s" % driver_input.timeout
357
        if driver_input.should_run_pixel_test:
359
        if driver_input.should_run_pixel_test:
358
            command += "'--pixel-test"
360
            command += "'--pixel-test"
359
        if driver_input.image_hash:
361
        if driver_input.image_hash:
(-)a/Tools/Scripts/webkitpy/layout_tests/port/qt.py (+3 lines)
Lines 80-85 class QtPort(Port): Link Here
80
        # The Qt port builds DRT as part of the main build step
80
        # The Qt port builds DRT as part of the main build step
81
        return True
81
        return True
82
82
83
    def supports_per_test_timeout(self):
84
        return True
85
83
    def _path_to_driver(self):
86
    def _path_to_driver(self):
84
        return self._build_path('bin/%s' % self.driver_name())
87
        return self._build_path('bin/%s' % self.driver_name())
85
88
(-)a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (+6 lines)
Lines 55-60 InjectedBundle::InjectedBundle() Link Here
55
    , m_dumpPixels(false)
55
    , m_dumpPixels(false)
56
    , m_useWaitToDumpWatchdogTimer(true)
56
    , m_useWaitToDumpWatchdogTimer(true)
57
    , m_useWorkQueue(false)
57
    , m_useWorkQueue(false)
58
    , m_timeout(0)
58
{
59
{
59
}
60
}
60
61
Lines 154-159 void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag Link Here
154
        WKRetainPtr<WKStringRef> useWaitToDumpWatchdogTimerKey(AdoptWK, WKStringCreateWithUTF8CString("UseWaitToDumpWatchdogTimer"));
155
        WKRetainPtr<WKStringRef> useWaitToDumpWatchdogTimerKey(AdoptWK, WKStringCreateWithUTF8CString("UseWaitToDumpWatchdogTimer"));
155
        m_useWaitToDumpWatchdogTimer = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, useWaitToDumpWatchdogTimerKey.get())));
156
        m_useWaitToDumpWatchdogTimer = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, useWaitToDumpWatchdogTimerKey.get())));
156
157
158
        WKRetainPtr<WKStringRef> timeoutKey(AdoptWK, WKStringCreateWithUTF8CString("Timeout"));
159
        m_timeout = WKDoubleGetValue(static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, timeoutKey.get())));
160
157
        WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
161
        WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
158
        WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
162
        WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
159
        WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
163
        WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
Lines 266-271 void InjectedBundle::beginTesting(WKDictionaryRef settings) Link Here
266
    m_testRunner->setAcceptsEditing(true);
270
    m_testRunner->setAcceptsEditing(true);
267
    m_testRunner->setTabKeyCyclesThroughElements(true);
271
    m_testRunner->setTabKeyCyclesThroughElements(true);
268
272
273
    m_testRunner->setCustomTimeout(m_timeout);
274
269
    page()->prepare();
275
    page()->prepare();
270
276
271
    WKBundleClearAllDatabases(m_bundle);
277
    WKBundleClearAllDatabases(m_bundle);
(-)a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (+1 lines)
Lines 156-161 private: Link Here
156
    bool m_dumpPixels;
156
    bool m_dumpPixels;
157
    bool m_useWaitToDumpWatchdogTimer;
157
    bool m_useWaitToDumpWatchdogTimer;
158
    bool m_useWorkQueue;
158
    bool m_useWorkQueue;
159
    double m_timeout;
159
160
160
    WKRetainPtr<WKImageRef> m_pixelResult;
161
    WKRetainPtr<WKImageRef> m_pixelResult;
161
    WKRetainPtr<WKArrayRef> m_repaintRects;
162
    WKRetainPtr<WKArrayRef> m_repaintRects;
(-)a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (+5 lines)
Lines 166-171 void TestRunner::notifyDone() Link Here
166
    m_waitToDump = false;
166
    m_waitToDump = false;
167
}
167
}
168
168
169
void TestRunner::setCustomTimeout(double timeout)
170
{
171
    m_timeout = timeout;
172
}
173
169
unsigned TestRunner::numberOfActiveAnimations() const
174
unsigned TestRunner::numberOfActiveAnimations() const
170
{
175
{
171
    // FIXME: Is it OK this works only for the main frame?
176
    // FIXME: Is it OK this works only for the main frame?
(-)a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (+4 lines)
Lines 261-266 public: Link Here
261
261
262
    bool callShouldCloseOnWebView();
262
    bool callShouldCloseOnWebView();
263
263
264
    void setCustomTimeout(double duration);
265
264
    // Work queue.
266
    // Work queue.
265
    void queueBackNavigation(unsigned howFarBackward);
267
    void queueBackNavigation(unsigned howFarBackward);
266
    void queueForwardNavigation(unsigned howFarForward);
268
    void queueForwardNavigation(unsigned howFarForward);
Lines 313-318 private: Link Here
313
    bool m_globalFlag;
315
    bool m_globalFlag;
314
    bool m_customFullScreenBehavior;
316
    bool m_customFullScreenBehavior;
315
317
318
    double m_timeout;
319
316
    bool m_userStyleSheetEnabled;
320
    bool m_userStyleSheetEnabled;
317
    WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
321
    WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
318
322
(-)a/Tools/WebKitTestRunner/InjectedBundle/qt/TestRunnerQt.cpp (-1 / +6 lines)
Lines 74-86 void TestRunner::invalidateWaitToDumpWatchdogTimer() Link Here
74
74
75
void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
75
void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
76
{
76
{
77
    double timerInterval;
77
    if (qgetenv("QT_WEBKIT2_DEBUG") == "1")
78
    if (qgetenv("QT_WEBKIT2_DEBUG") == "1")
78
        return;
79
        return;
79
80
80
    if (m_waitToDumpWatchdogTimer.isActive())
81
    if (m_waitToDumpWatchdogTimer.isActive())
81
        return;
82
        return;
83
    if (m_timeout > 0)
84
        timerInterval = m_timeout;
85
    else
86
        timerInterval = waitToDumpWatchdogTimerInterval * 1000;
82
87
83
    m_waitToDumpWatchdogTimer.start(waitToDumpWatchdogTimerInterval * 1000);
88
    m_waitToDumpWatchdogTimer.start(timerInterval);
84
}
89
}
85
90
86
JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
91
JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
(-)a/Tools/WebKitTestRunner/TestController.cpp (-11 / +23 lines)
Lines 93-98 TestController::TestController(int argc, const char* argv[]) Link Here
93
    , m_noTimeout(defaultNoTimeout)
93
    , m_noTimeout(defaultNoTimeout)
94
    , m_useWaitToDumpWatchdogTimer(true)
94
    , m_useWaitToDumpWatchdogTimer(true)
95
    , m_forceNoTimeout(false)
95
    , m_forceNoTimeout(false)
96
    , m_timeout(0)
96
    , m_didPrintWebProcessCrashedMessage(false)
97
    , m_didPrintWebProcessCrashedMessage(false)
97
    , m_shouldExitWhenWebProcessCrashes(true)
98
    , m_shouldExitWhenWebProcessCrashes(true)
98
    , m_beforeUnloadReturnValue(true)
99
    , m_beforeUnloadReturnValue(true)
Lines 169-174 static void decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, W Link Here
169
    TestController::shared().handleGeolocationPermissionRequest(permissionRequest);
170
    TestController::shared().handleGeolocationPermissionRequest(permissionRequest);
170
}
171
}
171
172
173
double TestController::getCustomTimeout()
174
{
175
    return m_timeout;
176
}
177
172
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
178
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
173
{
179
{
174
    PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage));
180
    PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage));
Lines 585-595 bool TestController::resetStateToConsistentValues() Link Here
585
}
591
}
586
592
587
struct TestCommand {
593
struct TestCommand {
588
    TestCommand() : shouldDumpPixels(false) { }
594
    TestCommand() : shouldDumpPixels(false), timeout(0) { }
589
595
590
    std::string pathOrURL;
596
    std::string pathOrURL;
591
    bool shouldDumpPixels;
597
    bool shouldDumpPixels;
592
    std::string expectedPixelHash;
598
    std::string expectedPixelHash;
599
    double timeout;
593
};
600
};
594
601
595
class CommandTokenizer {
602
class CommandTokenizer {
Lines 651-667 TestCommand parseInputLine(const std::string& inputLine) Link Here
651
    if (!tokenizer.hasNext())
658
    if (!tokenizer.hasNext())
652
        die(inputLine);
659
        die(inputLine);
653
660
654
    result.pathOrURL = tokenizer.next();
655
    if (!tokenizer.hasNext())
656
        return result;
657
658
    std::string arg = tokenizer.next();
661
    std::string arg = tokenizer.next();
659
    if (arg != std::string("-p") && arg != std::string("--pixel-test"))
662
    result.pathOrURL = arg;
660
        die(inputLine);
663
    while (tokenizer.hasNext()) {
661
    result.shouldDumpPixels = true;
664
        arg = tokenizer.next();
662
665
        if (arg == std::string("--timeout")) {
663
    if (tokenizer.hasNext())
666
            std::string timeoutToken = tokenizer.next();
664
        result.expectedPixelHash = tokenizer.next();
667
            result.timeout = atof(timeoutToken.c_str());
668
        } else if (arg == std::string("-p") || arg == std::string("--pixel-test")) {
669
            result.shouldDumpPixels = true;
670
            if (tokenizer.hasNext())
671
                result.expectedPixelHash = tokenizer.next();
672
        } else
673
            die(inputLine);
674
    }
665
675
666
    return result;
676
    return result;
667
}
677
}
Lines 675-680 bool TestController::runTest(const char* inputLine) Link Here
675
    m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL));
685
    m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL));
676
    if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests)
686
    if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests)
677
        m_currentInvocation->setIsPixelTest(command.expectedPixelHash);
687
        m_currentInvocation->setIsPixelTest(command.expectedPixelHash);
688
    if (command.timeout > 0)
689
        m_currentInvocation->setCustomTimeout(command.timeout);
678
690
679
    m_currentInvocation->invoke();
691
    m_currentInvocation->invoke();
680
    m_currentInvocation.clear();
692
    m_currentInvocation.clear();
(-)a/Tools/WebKitTestRunner/TestController.h (+4 lines)
Lines 64-69 public: Link Here
64
    bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; }
64
    bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; }
65
    void runUntil(bool& done, TimeoutDuration);
65
    void runUntil(bool& done, TimeoutDuration);
66
    void notifyDone();
66
    void notifyDone();
67
68
    double getCustomTimeout();
67
    
69
    
68
    bool beforeUnloadReturnValue() const { return m_beforeUnloadReturnValue; }
70
    bool beforeUnloadReturnValue() const { return m_beforeUnloadReturnValue; }
69
    void setBeforeUnloadReturnValue(bool value) { m_beforeUnloadReturnValue = value; }
71
    void setBeforeUnloadReturnValue(bool value) { m_beforeUnloadReturnValue = value; }
Lines 165-170 private: Link Here
165
    bool m_useWaitToDumpWatchdogTimer;
167
    bool m_useWaitToDumpWatchdogTimer;
166
    bool m_forceNoTimeout;
168
    bool m_forceNoTimeout;
167
169
170
    double m_timeout;
171
168
    bool m_didPrintWebProcessCrashedMessage;
172
    bool m_didPrintWebProcessCrashedMessage;
169
    bool m_shouldExitWhenWebProcessCrashes;
173
    bool m_shouldExitWhenWebProcessCrashes;
170
    
174
    
(-)a/Tools/WebKitTestRunner/TestInvocation.cpp (+10 lines)
Lines 100-105 TestInvocation::TestInvocation(const std::string& pathOrURL) Link Here
100
    : m_url(AdoptWK, createWKURL(pathOrURL.c_str()))
100
    : m_url(AdoptWK, createWKURL(pathOrURL.c_str()))
101
    , m_pathOrURL(pathOrURL)
101
    , m_pathOrURL(pathOrURL)
102
    , m_dumpPixels(false)
102
    , m_dumpPixels(false)
103
    , m_timeout(0)
103
    , m_gotInitialResponse(false)
104
    , m_gotInitialResponse(false)
104
    , m_gotFinalMessage(false)
105
    , m_gotFinalMessage(false)
105
    , m_gotRepaint(false)
106
    , m_gotRepaint(false)
Lines 118-123 void TestInvocation::setIsPixelTest(const std::string& expectedPixelHash) Link Here
118
    m_expectedPixelHash = expectedPixelHash;
119
    m_expectedPixelHash = expectedPixelHash;
119
}
120
}
120
121
122
void TestInvocation::setCustomTimeout(double timeout)
123
{
124
    m_timeout = timeout;
125
}
126
121
static const unsigned w3cSVGWidth = 480;
127
static const unsigned w3cSVGWidth = 480;
122
static const unsigned w3cSVGHeight = 360;
128
static const unsigned w3cSVGHeight = 360;
123
static const unsigned normalWidth = 800;
129
static const unsigned normalWidth = 800;
Lines 185-190 void TestInvocation::invoke() Link Here
185
    WKRetainPtr<WKBooleanRef> useWaitToDumpWatchdogTimerValue = adoptWK(WKBooleanCreate(TestController::shared().useWaitToDumpWatchdogTimer()));
191
    WKRetainPtr<WKBooleanRef> useWaitToDumpWatchdogTimerValue = adoptWK(WKBooleanCreate(TestController::shared().useWaitToDumpWatchdogTimer()));
186
    WKDictionaryAddItem(beginTestMessageBody.get(), useWaitToDumpWatchdogTimerKey.get(), useWaitToDumpWatchdogTimerValue.get());
192
    WKDictionaryAddItem(beginTestMessageBody.get(), useWaitToDumpWatchdogTimerKey.get(), useWaitToDumpWatchdogTimerValue.get());
187
193
194
    WKRetainPtr<WKStringRef> timeoutKey = adoptWK(WKStringCreateWithUTF8CString("Timeout"));
195
    WKRetainPtr<WKDoubleRef> timeoutValue = adoptWK(WKDoubleCreate(m_timeout));
196
    WKDictionaryAddItem(beginTestMessageBody.get(), timeoutKey.get(), timeoutValue.get());
197
188
    WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get());
198
    WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), beginTestMessageBody.get());
189
199
190
    TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout);
200
    TestController::shared().runUntil(m_gotInitialResponse, TestController::ShortTimeout);
(-)a/Tools/WebKitTestRunner/TestInvocation.h (+4 lines)
Lines 40-45 public: Link Here
40
40
41
    void setIsPixelTest(const std::string& expectedPixelHash);
41
    void setIsPixelTest(const std::string& expectedPixelHash);
42
42
43
    void setCustomTimeout(double duration);
44
43
    void invoke();
45
    void invoke();
44
    void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
46
    void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
45
    WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
47
    WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
Lines 62-67 private: Link Here
62
    bool m_dumpPixels;
64
    bool m_dumpPixels;
63
    std::string m_expectedPixelHash;
65
    std::string m_expectedPixelHash;
64
66
67
    double m_timeout;
68
65
    // Invocation state
69
    // Invocation state
66
    bool m_gotInitialResponse;
70
    bool m_gotInitialResponse;
67
    bool m_gotFinalMessage;
71
    bool m_gotFinalMessage;
(-)a/Tools/WebKitTestRunner/qt/TestControllerQt.cpp (-2 / +4 lines)
Lines 62-73 void TestController::platformRunUntil(bool& condition, double timeout) Link Here
62
        return;
62
        return;
63
    }
63
    }
64
64
65
    int timeoutInMSecs = timeout * 1000;
65
    double timeoutInMSecs = timeout * 1000;
66
    QElapsedTimer timer;
66
    QElapsedTimer timer;
67
    timer.start();
67
    timer.start();
68
    while (!condition) {
68
    while (!condition) {
69
        if (timer.elapsed() > timeoutInMSecs)
69
        if (timer.elapsed() > timeoutInMSecs) {
70
            condition = !condition;
70
            return;
71
            return;
72
        }
71
        QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, timeoutInMSecs - timer.elapsed());
73
        QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, timeoutInMSecs - timer.elapsed());
72
    }
74
    }
73
}
75
}

Return to bug 90968