Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: webkit/tools/test_shell/test_shell_mac.mm

Issue 14841004: Remove remaining references to test_shell_tests now that the bots have been updated. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/test_shell_gtk.cc ('k') | webkit/tools/test_shell/test_shell_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/test_shell_mac.mm
===================================================================
--- webkit/tools/test_shell/test_shell_mac.mm (revision 197949)
+++ webkit/tools/test_shell/test_shell_mac.mm (working copy)
@@ -357,100 +357,6 @@
return true;
}
-void TestShell::TestFinished() {
- if (!test_is_pending_)
- return; // reached when running under test_shell_tests
-
- test_is_pending_ = false;
- MessageLoop::current()->Quit();
-}
-
-// A class to be the target/selector of the "watchdog" thread that ensures
-// pages timeout if they take too long and tells the test harness via stdout.
-@interface WatchDogTarget : NSObject {
- @private
- NSTimeInterval timeout_;
-}
-// |timeout| is in seconds
-- (id)initWithTimeout:(NSTimeInterval)timeout;
-// serves as the "run" method of a NSThread.
-- (void)run:(id)sender;
-@end
-
-@implementation WatchDogTarget
-
-- (id)initWithTimeout:(NSTimeInterval)timeout {
- if ((self = [super init])) {
- timeout_ = timeout;
- }
- return self;
-}
-
-- (void)run:(id)ignore {
- base::mac::ScopedNSAutoreleasePool scoped_pool;
-
- // Check for debugger, just bail if so. We don't want the timeouts hitting
- // when we're trying to track down an issue.
- if (base::debug::BeingDebugged())
- return;
-
- NSThread* currentThread = [NSThread currentThread];
-
- // Wait to be cancelled. If we are that means the test finished. If it hasn't,
- // then we need to tell the layout script we timed out and start again.
- NSDate* limitDate = [NSDate dateWithTimeIntervalSinceNow:timeout_];
- while ([(NSDate*)[NSDate date] compare:limitDate] == NSOrderedAscending &&
- ![currentThread isCancelled]) {
- // sleep for a small increment then check again
- NSDate* incrementDate = [NSDate dateWithTimeIntervalSinceNow:1.0];
- [NSThread sleepUntilDate:incrementDate];
- }
- if (![currentThread isCancelled]) {
- // Print a warning to be caught by the layout-test script.
- // Note: the layout test driver may or may not recognize
- // this as a timeout.
- puts("#TEST_TIMED_OUT\n");
- puts("#EOF\n");
- fflush(stdout);
- abort();
- }
-}
-
-@end
-
-void TestShell::WaitTestFinished() {
- DCHECK(!test_is_pending_) << "cannot be used recursively";
-
- test_is_pending_ = true;
-
- // Create a watchdog thread which just sets a timer and
- // kills the process if it times out. This catches really
- // bad hangs where the shell isn't coming back to the
- // message loop. If the watchdog is what catches a
- // timeout, it can't do anything except terminate the test
- // shell, which is unfortunate.
- // Windows multiplies by 2.5, but that causes us to run for far, far too
- // long. We use the passed value and let the scripts flag override
- // the value as needed.
- NSTimeInterval timeout_seconds = GetLayoutTestTimeoutForWatchDog() / 1000;
- WatchDogTarget* watchdog = [[[WatchDogTarget alloc]
- initWithTimeout:timeout_seconds] autorelease];
- NSThread* thread = [[NSThread alloc] initWithTarget:watchdog
- selector:@selector(run:)
- object:nil];
- [thread start];
-
- // TestFinished() will post a quit message to break this loop when the page
- // finishes loading.
- while (test_is_pending_)
- MessageLoop::current()->Run();
-
- // Tell the watchdog that we're finished. No point waiting to re-join, it'll
- // die on its own.
- [thread cancel];
- [thread release];
-}
-
void TestShell::InteractiveSetFocus(WebWidgetHost* host, bool enable) {
if (enable) {
[[host->view_handle() window] makeKeyAndOrderFront:nil];
« no previous file with comments | « webkit/tools/test_shell/test_shell_gtk.cc ('k') | webkit/tools/test_shell/test_shell_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698