diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-04 16:54:01 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-04 16:54:01 +0000 |
commit | bbe0af065171c8c3c226ab45087822d37218fb77 (patch) | |
tree | 7094fce066b9c4d1e6eb4822a06884dbb45be67d /webkit | |
parent | be8c5ad496da6dabb5d3689b0613348fffbed4c9 (diff) | |
download | chromium_src-bbe0af065171c8c3c226ab45087822d37218fb77.zip chromium_src-bbe0af065171c8c3c226ab45087822d37218fb77.tar.gz chromium_src-bbe0af065171c8c3c226ab45087822d37218fb77.tar.bz2 |
Unify on "layout test mode" vs "interactive" and "non-interactive". We had a layout test mode flag in some places, and an interactive flag in others. It was especially confusing since interactive = !layout_test_mode.
This should make it much easier to grep for difference between layout test mode and normal "interactive" mode.
Review URL: http://codereview.chromium.org/12940
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/main.mm | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/run_all_tests.cc | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 19 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 21 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 7 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_switches.cc | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 14 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/text_input_controller.h | 2 |
13 files changed, 50 insertions, 54 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 70efb9a..86e0527 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -246,7 +246,7 @@ void LayoutTestController::waitUntilDone( void LayoutTestController::notifyDone( const CppArgumentList& args, CppVariant* result) { - if (!shell_->interactive() && wait_until_done_ && + if (shell_->layout_test_mode() && wait_until_done_ && !shell_->delegate()->top_loading_frame() && work_queue_.empty()) { shell_->TestFinished(); } @@ -608,7 +608,7 @@ void LayoutTestController::setPrivateBrowsingEnabled( void LayoutTestController::fallbackMethod( const CppArgumentList& args, CppVariant* result) { std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestController"); - if (shell_->interactive()) { + if (!shell_->layout_test_mode()) { logging::LogMessage("CONSOLE:", 0).stream() << message; } else { printf("CONSOLE MESSAGE: %S\n", message.c_str()); diff --git a/webkit/tools/test_shell/mac/main.mm b/webkit/tools/test_shell/mac/main.mm index 2dd87b9..0bb6c70 100644 --- a/webkit/tools/test_shell/mac/main.mm +++ b/webkit/tools/test_shell/mac/main.mm @@ -138,10 +138,9 @@ int main(const int argc, const char *argv[]) { parsed_command_line.HasSwitch(test_shell::kLayoutTests); bool layout_test_mode = parsed_command_line.HasSwitch(test_shell::kLayoutTests); - bool interactive = !layout_test_mode; TestShell::InitLogging(suppress_error_dialogs, layout_test_mode, false); - TestShell::InitializeTestShell(interactive); + TestShell::InitializeTestShell(layout_test_mode); bool no_tree = parsed_command_line.HasSwitch(test_shell::kNoTree); @@ -221,7 +220,7 @@ int main(const int argc, const char *argv[]) { std::wstring uri; // Default to a homepage if we're interactive - if (interactive) { + if (!layout_test_mode) { NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; NSString *testShellPath = [resourcePath stringByAppendingPathComponent:@"test_shell/index.html"]; diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc index 153ba85..7b990c5 100644 --- a/webkit/tools/test_shell/run_all_tests.cc +++ b/webkit/tools/test_shell/run_all_tests.cc @@ -59,9 +59,9 @@ int main(int argc, char* argv[]) { TestShell::SetFileTestTimeout(USER_TIMER_MAXIMUM); #endif - // Initialize test shell in non-interactive mode, which will let us load one + // Initialize test shell in layout test mode, which will let us load one // request than automatically quit. - TestShell::InitializeTestShell(false); + TestShell::InitializeTestShell(true); webkit_glue::InitializeForTesting(); diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index fa8b39d..d132a7f 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -44,8 +44,7 @@ namespace { -// Default timeout for page load when running non-interactive file -// tests, in ms. +// Default timeout in ms for file page loads when in layout test mode. const int kDefaultFileTestTimeoutMillisecs = 10 * 1000; // Content area size for newly created windows. @@ -96,7 +95,7 @@ class URLRequestTestShellFileJob : public URLRequestFileJob { // Initialize static member variable WindowList* TestShell::window_list_; WebPreferences* TestShell::web_prefs_ = NULL; -bool TestShell::interactive_ = true; +bool TestShell::layout_test_mode_ = false; int TestShell::file_test_timeout_ms_ = kDefaultFileTestTimeoutMillisecs; TestShell::TestShell() @@ -196,7 +195,7 @@ std::string TestShell::DumpImage(WebFrame* web_frame, // static void TestShell::InitLogging(bool suppress_error_dialogs, - bool running_layout_tests, + bool layout_test_mode, bool enable_gp_fault_error_box) { if (suppress_error_dialogs) logging::SetLogAssertHandler(UnitTestAssertHandler); @@ -219,7 +218,7 @@ void TestShell::InitLogging(bool suppress_error_dialogs, // output from disrupting whether or not we pass. logging::LoggingDestination destination = logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; - if (running_layout_tests) + if (layout_test_mode) destination = logging::LOG_ONLY_TO_FILE; // We might have multiple test_shell processes going at once @@ -237,7 +236,7 @@ void TestShell::InitLogging(bool suppress_error_dialogs, // Turn on logging of notImplemented()s inside WebKit, but only if we're // not running layout tests (because otherwise they'd corrupt the test // output). - if (!running_layout_tests) + if (!layout_test_mode) webkit_glue::EnableWebCoreNotImplementedLogging(); } @@ -287,7 +286,7 @@ void TestShell::ResetWebPreferences() { web_prefs_->minimum_logical_font_size = 9; web_prefs_->javascript_can_open_windows_automatically = true; web_prefs_->dom_paste_enabled = true; - web_prefs_->developer_extras_enabled = interactive_; + web_prefs_->developer_extras_enabled = !layout_test_mode_; web_prefs_->shrinks_standalone_images_to_fit = false; web_prefs_->uses_universal_detector = false; web_prefs_->text_areas_are_resizable = false; @@ -316,7 +315,7 @@ void TestShell::Show(WebView* webview, WindowOpenDisposition disposition) { void TestShell::BindJSObjectsToWindow(WebFrame* frame) { // Only bind the test classes if we're running tests. - if (!interactive_) { + if (layout_test_mode_) { layout_test_controller_->BindToJavascript(frame, L"layoutTestController"); event_sending_controller_->BindToJavascript(frame, @@ -336,7 +335,7 @@ void TestShell::CallJSGC() { WebView* TestShell::CreateWebView(WebView* webview) { // If we're running layout tests, only open a new window if the test has // called layoutTestController.setCanOpenWindows() - if (!interactive_ && !layout_test_controller_->CanOpenWindows()) + if (layout_test_mode_ && !layout_test_controller_->CanOpenWindows()) return NULL; TestShell* new_win; @@ -410,7 +409,7 @@ void TestShell::Reload() { } void TestShell::SetFocus(WebWidgetHost* host, bool enable) { - if (interactive_) { + if (!layout_test_mode_) { InteractiveSetFocus(host, enable); } else { if (enable) { diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 62ca208..95b0d47 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -76,10 +76,10 @@ public: static void CleanupLogging(); // Initialization and clean up of a static member variable. - static void InitializeTestShell(bool interactive); + static void InitializeTestShell(bool layout_test_mode); static void ShutdownTestShell(); - static bool interactive() { return interactive_; } + static bool layout_test_mode() { return layout_test_mode_; } // Called from the destructor to let each platform do any necessary // cleanup. @@ -100,8 +100,7 @@ public: void Show(WebView* webview, WindowOpenDisposition disposition); - // We use this to avoid relying on Windows focus during non-interactive - // mode. + // We use this to avoid relying on Windows focus during layout test mode. void SetFocus(WebWidgetHost* host, bool enable); LayoutTestController* layout_test_controller() { @@ -125,19 +124,19 @@ public: // Passes options from LayoutTestController through to the delegate (or // any other caller). bool ShouldDumpEditingCallbacks() { - return !interactive_ && + return layout_test_mode_ && layout_test_controller_->ShouldDumpEditingCallbacks(); } bool ShouldDumpFrameLoadCallbacks() { - return !interactive_ && (test_is_preparing_ || test_is_pending_) && + return layout_test_mode_ && (test_is_preparing_ || test_is_pending_) && layout_test_controller_->ShouldDumpFrameLoadCallbacks(); } bool ShouldDumpResourceLoadCallbacks() { - return !interactive_ && (test_is_preparing_ || test_is_pending_) && + return layout_test_mode_ && (test_is_preparing_ || test_is_pending_) && layout_test_controller_->ShouldDumpResourceLoadCallbacks(); } bool ShouldDumpTitleChanges() { - return !interactive_ && + return layout_test_mode_ && layout_test_controller_->ShouldDumpTitleChanges(); } bool AcceptsEditing() { @@ -288,10 +287,10 @@ private: static HINSTANCE instance_handle_; #endif - // False when the app is being run using the --layout-tests switch. - static bool interactive_; + // True when the app is being run using the --layout-tests switch. + static bool layout_test_mode_; - // Timeout for page load when running non-interactive file tests, in ms. + // Default timeout in ms for file page loads when in layout test mode. static int file_test_timeout_ms_; scoped_ptr<LayoutTestController> layout_test_controller_; diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 420c47a..28dceaaa 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -42,9 +42,9 @@ const FcChar8* FilePathAsFcChar(const FilePath& path) { } // static -void TestShell::InitializeTestShell(bool interactive) { +void TestShell::InitializeTestShell(bool layout_test_mode) { window_list_ = new WindowList; - interactive_ = interactive; + layout_test_mode_ = layout_test_mode; web_prefs_ = new WebPreferences; @@ -461,7 +461,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url, SizeToSVG(); else { // only resize back to the default when running tests - if (!interactive()) + if (layout_test_mode()) SizeToDefault(); } diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index d4603ea..a593501 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -51,8 +51,8 @@ const int kTestWindowHeight = 600; const int kSVGTestWindowWidth = 480; const int kSVGTestWindowHeight = 360; -// Hide the window offscreen when it is non-interactive. Mac OS X limits -// window positions to +/- 16000 +// Hide the window offscreen when in layout test mode. Mac OS X limits +// window positions to +/- 16000. const int kTestWindowXLocation = -14000; const int kTestWindowYLocation = -14000; @@ -127,9 +127,9 @@ void TestShell::PlatformShutdown() { } // static -void TestShell::InitializeTestShell(bool interactive) { +void TestShell::InitializeTestShell(bool layout_test_mode) { window_list_ = new WindowList; - interactive_ = interactive; + layout_test_mode_ = layout_test_mode; web_prefs_ = new WebPreferences; @@ -524,7 +524,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url, SizeTo(kSVGTestWindowWidth, kSVGTestWindowHeight); } else { // only resize back to the default when running tests - if (!interactive()) + if (layout_test_mode()) SizeToDefault(); } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index f8bd0be..b2f9830 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -235,14 +235,13 @@ int main(int argc, char* argv[]) { InitCommonControlsEx(&InitCtrlEx); #endif - bool interactive = !layout_test_mode; - TestShell::InitializeTestShell(interactive); + TestShell::InitializeTestShell(layout_test_mode); if (parsed_command_line.HasSwitch(test_shell::kAllowScriptsToCloseWindows)) TestShell::SetAllowScriptsToCloseWindows(); // Disable user themes for layout tests so pixel tests are consistent. - if (!interactive) { + if (layout_test_mode) { #if defined(OS_WIN) gfx::NativeTheme::instance()->DisableTheming(); #elif defined(OS_LINUX) @@ -272,7 +271,7 @@ int main(int argc, char* argv[]) { std::wstring uri; // Default to a homepage if we're interactive. - if (interactive) { + if (!layout_test_mode) { PathService::Get(base::DIR_SOURCE_ROOT, &uri); file_util::AppendToPath(&uri, L"webkit"); file_util::AppendToPath(&uri, L"data"); diff --git a/webkit/tools/test_shell/test_shell_switches.cc b/webkit/tools/test_shell/test_shell_switches.cc index 26b53e0..214dd96 100644 --- a/webkit/tools/test_shell/test_shell_switches.cc +++ b/webkit/tools/test_shell/test_shell_switches.cc @@ -18,7 +18,7 @@ const wchar_t kCrashDumps[] = L"crash-dumps"; // Enable crash dumps const wchar_t kNoTree[] = L"notree"; // Don't dump the render tree. const wchar_t kDumpPixels[] = L"pixel-tests"; // Enable pixel tests. // Optional command line switch that specifies timeout time for page load when -// running non-interactive file tests, in ms. +// running file tests in layout test mode, in ms. const wchar_t kTestShellTimeOut[] = L"time-out-ms"; const wchar_t kStartupDialog[] = L"testshell-startup-dialog"; diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index f5a25e7..1b71c2d 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -50,7 +50,7 @@ static wchar_t g_currentTestName[kPathBufSize]; // Forward declarations of functions included in this code module: static INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); -// Hide the window offscreen when it is non-interactive. +// Hide the window offscreen when in layout test mode. // This would correspond with a minimized window position if x = y = -32000. // However we shift the x to 0 to pass test cross-frame-access-put.html // which expects screenX/screenLeft to be 0 (http://b/issue?id=1227945). @@ -119,14 +119,14 @@ HINSTANCE TestShell::instance_handle_; ///////////////////////////////////////////////////////////////////////////// // static methods on TestShell -void TestShell::InitializeTestShell(bool interactive) { +void TestShell::InitializeTestShell(bool layout_test_mode) { // Start COM stuff. HRESULT res = OleInitialize(NULL); DCHECK(SUCCEEDED(res)); window_list_ = new WindowList; instance_handle_ = ::GetModuleHandle(NULL); - interactive_ = interactive; + layout_test_mode_ = layout_test_mode; web_prefs_ = new WebPreferences; @@ -547,7 +547,7 @@ void TestShell::LoadURLForFrame(const wchar_t* url, SizeToSVG(); } else { // only resize back to the default when running tests - if (!interactive()) + if (layout_test_mode()) SizeToDefault(); } diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 17d3786..061cc9b 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -214,7 +214,7 @@ void TestWebViewDelegate::DidFailProvisionalLoadWithError( // Don't display an error page if we're running layout tests, because // DumpRenderTree doesn't. - if (!shell_->interactive()) + if (shell_->layout_test_mode()) return; // Don't display an error page if this is simply a cancelled load. Aside @@ -352,7 +352,7 @@ void TestWebViewDelegate::AddMessageToConsole(WebView* webview, const std::wstring& message, unsigned int line_no, const std::wstring& source_id) { - if (shell_->interactive()) { + if (!shell_->layout_test_mode()) { logging::LogMessage("CONSOLE", 0).stream() << "\"" << message.c_str() << ",\" source: " @@ -379,7 +379,7 @@ void TestWebViewDelegate::AddMessageToConsole(WebView* webview, void TestWebViewDelegate::RunJavaScriptAlert(WebView* webview, const std::wstring& message) { - if (shell_->interactive()) { + if (!shell_->layout_test_mode()) { ShowJavaScriptAlert(message); } else { std::string utf8 = WideToUTF8(message); @@ -389,7 +389,7 @@ void TestWebViewDelegate::RunJavaScriptAlert(WebView* webview, bool TestWebViewDelegate::RunJavaScriptConfirm(WebView* webview, const std::wstring& message) { - if (!shell_->interactive()) { + if (shell_->layout_test_mode()) { // When running tests, write to stdout. std::string utf8 = WideToUTF8(message); printf("CONFIRM: %s\n", utf8.c_str()); @@ -401,7 +401,7 @@ bool TestWebViewDelegate::RunJavaScriptConfirm(WebView* webview, bool TestWebViewDelegate::RunJavaScriptPrompt(WebView* webview, const std::wstring& message, const std::wstring& default_value, std::wstring* result) { - if (!shell_->interactive()) { + if (shell_->layout_test_mode()) { // When running tests, write to stdout. std::string utf8_message = WideToUTF8(message); std::string utf8_default_value = WideToUTF8(default_value); @@ -455,7 +455,7 @@ void TestWebViewDelegate::ShowContextMenu(WebView* webview, captured_context_menu_events_.push_back(context); } -// The output from these methods in non-interactive mode should match that +// The output from these methods in layout test mode should match that // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. bool TestWebViewDelegate::ShouldBeginEditing(WebView* webview, std::wstring range) { @@ -687,7 +687,7 @@ void TestWebViewDelegate::LocationChangeDone(WebDataSource* data_source) { if (data_source->GetWebFrame() == top_loading_frame_) { top_loading_frame_ = NULL; - if (!shell_->interactive()) + if (shell_->layout_test_mode()) shell_->layout_test_controller()->LocationChangeDone(); } } diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index bc8d226..1bded4f 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -255,7 +255,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, void SetAddressBarURL(const GURL& url); // Show a JavaScript alert as a popup message. - // The caller should test whether we're in interactive mode and only + // The caller should test whether we're in layout test mode and only // call this function when we really want a message to pop up. void ShowJavaScriptAlert(const std::wstring& message); diff --git a/webkit/tools/test_shell/text_input_controller.h b/webkit/tools/test_shell/text_input_controller.h index ce04708..99d7ca9 100644 --- a/webkit/tools/test_shell/text_input_controller.h +++ b/webkit/tools/test_shell/text_input_controller.h @@ -3,7 +3,7 @@ // found in the LICENSE file. // TextInputController is bound to window.textInputController in Javascript -// when test_shell is running noninteractively. Layout tests use it to +// when test_shell is running in layout test mode. Layout tests use it to // exercise various corners of text input. // // Mac equivalent: WebKit/WebKitTools/DumpRenderTree/TextInputController.{h,m} |