diff options
Diffstat (limited to 'webkit/tools/test_shell/test_shell_mac.mm')
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index dea940a..54c2859 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -109,8 +109,8 @@ FilePath GetResourcesFilePath() { // clean ourselves up and do the work after clearing the stack of anything // that might have the shell on it. - [self performSelectorOnMainThread:@selector(cleanup:) - withObject:window + [self performSelectorOnMainThread:@selector(cleanup:) + withObject:window waitUntilDone:NO]; return YES; @@ -161,7 +161,7 @@ void TestShell::PlatformShutdown() { } // assert if we have anything left over, that would be bad. DCHECK(window_map_.Get().size() == 0); - + // Dump the pasteboards we built up. [DumpRenderTreePasteboard releaseLocalPasteboards]; } @@ -173,9 +173,9 @@ void TestShell::InitializeTestShell(bool layout_test_mode) { window_list_ = new WindowList; layout_test_mode_ = layout_test_mode; - + web_prefs_ = new WebPreferences; - + ResetWebPreferences(); // Load the Ahem font, which is used by layout tests. @@ -214,7 +214,7 @@ NSButton* MakeTestButton(NSRect* rect, NSString* title, NSView* parent) { bool TestShell::Initialize(const std::wstring& startingURL) { // Perform application initialization: // send message to app controller? need to work this out - + // TODO(awalker): this is a straight recreation of windows test_shell.cc's // window creation code--we should really pull this from the nib and grab // references to the already-created subviews that way. @@ -230,30 +230,30 @@ bool TestShell::Initialize(const std::wstring& startingURL) { backing:NSBackingStoreBuffered defer:NO]; [m_mainWnd setTitle:@"TestShell"]; - + // Add to our map window_map_.Get()[m_mainWnd] = this; - + // Create a window delegate to watch for when it's asked to go away. It will // clean itself up so we don't need to hold a reference. [m_mainWnd setDelegate:[[WindowCloseDelegate alloc] init]]; - - // Rely on the window delegate to clean us up rather than immediately - // releasing when the window gets closed. We use the delegate to do + + // Rely on the window delegate to clean us up rather than immediately + // releasing when the window gets closed. We use the delegate to do // everything from the autorelease pool so the shell isn't on the stack // during cleanup (ie, a window close from javascript). [m_mainWnd setReleasedWhenClosed:NO]; - + // Create a webview. Note that |web_view| takes ownership of this shell so we // will get cleaned up when it gets destroyed. m_webViewHost.reset( WebViewHost::Create([m_mainWnd contentView], delegate_.get(), *TestShell::web_prefs_)); webView()->SetUseEditorDelegate(true); delegate_->RegisterDragDrop(); - TestShellWebView* web_view = + TestShellWebView* web_view = static_cast<TestShellWebView*>(m_webViewHost->view_handle()); [web_view setShell:this]; - + // create buttons NSRect button_rect = [[m_mainWnd contentView] bounds]; button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT + @@ -261,27 +261,27 @@ bool TestShell::Initialize(const std::wstring& startingURL) { button_rect.size.height = BUTTON_HEIGHT; button_rect.origin.x += BUTTON_MARGIN; button_rect.size.width = BUTTON_WIDTH; - + NSView* content = [m_mainWnd contentView]; - + NSButton* button = MakeTestButton(&button_rect, @"Back", content); [button setTarget:web_view]; [button setAction:@selector(goBack:)]; - + button = MakeTestButton(&button_rect, @"Forward", content); [button setTarget:web_view]; [button setAction:@selector(goForward:)]; - + // reload button button = MakeTestButton(&button_rect, @"Reload", content); [button setTarget:web_view]; [button setAction:@selector(reload:)]; - + // stop button button = MakeTestButton(&button_rect, @"Stop", content); [button setTarget:web_view]; [button setAction:@selector(stopLoading:)]; - + // text field for URL button_rect.origin.x += BUTTON_MARGIN; button_rect.size.width = [[m_mainWnd contentView] bounds].size.width - @@ -296,7 +296,7 @@ bool TestShell::Initialize(const std::wstring& startingURL) { // show the window [m_mainWnd makeKeyAndOrderFront: nil]; - + // Load our initial content. if (!startingURL.empty()) LoadURL(startingURL.c_str()); @@ -315,7 +315,7 @@ bool TestShell::Initialize(const std::wstring& startingURL) { void TestShell::TestFinished() { if (!test_is_pending_) return; // reached when running under test_shell_tests - + test_is_pending_ = false; NSWindow* window = *(TestShell::windowList()->begin()); WindowMap::iterator it = window_map_.Get().find(window); @@ -347,14 +347,14 @@ void TestShell::TestFinished() { - (void)run:(id)ignore { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - + // check for debugger, just bail if so. We don't want the timeouts hitting // when we're trying to track down an issue. if (DebugUtil::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_]; @@ -381,26 +381,26 @@ void TestShell::TestFinished() { 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 + // 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 = GetLayoutTestTimeoutInSeconds(); - WatchDogTarget* watchdog = [[[WatchDogTarget alloc] + WatchDogTarget* watchdog = [[[WatchDogTarget alloc] initWithTimeout:timeout_seconds] autorelease]; NSThread* thread = [[NSThread alloc] initWithTarget:watchdog - selector:@selector(run:) + 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_) @@ -444,7 +444,7 @@ WebWidget* TestShell::CreatePopupWidget(WebView* webview) { DCHECK(!m_popupHost); m_popupHost = WebWidgetHost::Create(NULL, delegate_.get()); // ShowWindow(popupWnd(), SW_SHOW); - + return m_popupHost->webwidget(); } @@ -492,7 +492,7 @@ void TestShell::ResizeSubViews() { DCHECK(shell); shell->ResetTestController(); - // ResetTestController may have closed the window we were holding on to. + // ResetTestController may have closed the window we were holding on to. // Grab the first window again. window = *(TestShell::windowList()->begin()); shell = window_map_.Get()[window]; @@ -536,7 +536,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url, const wchar_t* frame_name) { if (!url) return; - + std::string url8 = WideToUTF8(url); bool bIsSVGTest = strstr(url8.c_str(), "W3C-SVG-1.1") > 0; @@ -567,12 +567,12 @@ bool TestShell::PromptForSaveFile(const wchar_t* prompt_title, std::wstring* result) { NSSavePanel* save_panel = [NSSavePanel savePanel]; - + /* set up new attributes */ [save_panel setRequiredFileType:@"txt"]; [save_panel setMessage: [NSString stringWithUTF8String:WideToUTF8(prompt_title).c_str()]]; - + /* display the NSSavePanel */ if ([save_panel runModalForDirectory:NSHomeDirectory() file:@""] == NSOKButton) { |