diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-23 01:02:02 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-23 01:02:02 +0000 |
commit | 544219f4ebbc269a5b4cc7346286d1a21d5138c2 (patch) | |
tree | bfb3cf20316612e32bfd2a9cea681c306dbc6b11 /webkit/tools | |
parent | 1da70a5924f41d7e2682c43e175b1b05796d13d4 (diff) | |
download | chromium_src-544219f4ebbc269a5b4cc7346286d1a21d5138c2.zip chromium_src-544219f4ebbc269a5b4cc7346286d1a21d5138c2.tar.gz chromium_src-544219f4ebbc269a5b4cc7346286d1a21d5138c2.tar.bz2 |
Dump text/image on notifyDone.
Review URL: http://codereview.chromium.org/18440
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8532 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/layout_tests/test_lists/tests_fixable.txt | 53 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj | 14 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/main.mm | 6 | ||||
-rwxr-xr-x | webkit/tools/test_shell/test_shell.cc | 71 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 26 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.vsprops | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 77 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 82 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 7 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 73 |
10 files changed, 196 insertions, 215 deletions
diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index 8ab6196..721beed 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -353,22 +353,16 @@ LINUX : LayoutTests/fast/backgrounds/svg-as-background-1.html = FAIL LINUX : LayoutTests/fast/backgrounds/svg-as-background-2.html = FAIL LINUX : LayoutTests/fast/backgrounds/svg-as-background-4.html = FAIL LINUX : LayoutTests/fast/backgrounds/svg-as-background-5.html = FAIL CRASH -LINUX : LayoutTests/fast/images/animated-svg-as-image.html = FAIL -LINUX : LayoutTests/fast/overflow/float-in-relpositioned.html = FAIL -LINUX : LayoutTests/fast/table/prepend-in-anonymous-table.html = FAIL -LINUX : LayoutTests/fast/table/vertical-align-baseline.html = FAIL LINUX : LayoutTests/fast/text/bidi-embedding-pop-and-push-same.html = FAIL LINUX : LayoutTests/fast/text/international/001.html = FAIL LINUX : LayoutTests/fast/text/international/002.html = FAIL LINUX : LayoutTests/fast/text/international/003.html = FAIL LINUX : LayoutTests/fast/text/international/wrap-CJK-001.html = FAIL // Font differences, requiring overriden metrics, not a real bug, not fixing for Beta -LINUX : LayoutTests/fast/replaced/percent-height-in-anonymous-block-widget.html = FAIL DEFER LINUX : LayoutTests/fast/text/international/bidi-AN-after-L.html = FAIL DEFER MAC LINUX : LayoutTests/fast/text/international/bidi-menulist.html = FAIL DEFER LINUX : LayoutTests/fast/text/international/bidi-neutral-run.html = FAIL DEFER LINUX : LayoutTests/fast/text/international/thai-line-breaks.html = FAIL -LINUX : LayoutTests/fast/transforms/overflow-with-transform.html = FAIL DEFER MAC LINUX : LayoutTests/svg/batik/text/textFeatures.svg = FAIL PASS DEFER LINUX : LayoutTests/svg/batik/text/textOnPath2.svg = FAIL DEFER LINUX : LayoutTests/svg/batik/text/textOnPath3.svg = FAIL @@ -377,7 +371,6 @@ LINUX : LayoutTests/svg/batik/text/textPCDATA.svg = FAIL LINUX : LayoutTests/svg/batik/text/textPosition2.svg = FAIL LINUX : LayoutTests/svg/carto.net/colourpicker.svg = FAIL LINUX : LayoutTests/svg/custom/circular-marker-reference-2.svg = FAIL -LINUX : LayoutTests/svg/custom/stroke-fallback.svg = FAIL DEFER LINUX : LayoutTests/svg/custom/use-css-events.svg = FAIL // 5 numbers differ, by an absolute total of 27.16 LINUX : LayoutTests/svg/custom/foreign-object-skew.svg = FAIL MAC : LayoutTests/svg/custom/inline-svg-in-xhtml.xml = FAIL @@ -832,6 +825,12 @@ LINUX : LayoutTests/fast/canvas/canvas-text-alignment.html = FAIL LINUX WIN : LayoutTests/fast/gradients/generated-gradients.html = FAIL // Linux pixeltest failure: radial gradients don't have offset focal point LINUX WIN : LayoutTests/fast/gradients/simple-gradients.html = FAIL +LINUX WIN : LayoutTests/fast/overflow/float-in-relpositioned.html = FAIL +// Our pixel results have a darker green color. +WIN : LayoutTests/fast/table/border-collapsing/equal-precedence-resolution.html = FAIL +LINUX WIN : LayoutTests/fast/table/prepend-in-anonymous-table.html = FAIL +LINUX WIN : LayoutTests/fast/table/vertical-align-baseline.html = FAIL +LINUX WIN : LayoutTests/fast/transforms/overflow-with-transform.html = FAIL // Linux pixeltest failure: Failing to render shadows LINUX WIN : LayoutTests/fast/transforms/shadows.html = FAIL LayoutTests/http/tests/misc/acid3.html = FAIL TIMEOUT @@ -946,9 +945,9 @@ LINUX : LayoutTests/fast/encoding/denormalised-voiced-japanese-chars.html = FAIL LINUX MAC : LayoutTests/fast/events/updateLayoutForHitTest.html = FAIL // Off-by-one in form controls -- font metrics? -MAC : LayoutTests/fast/forms/input-baseline.html = FAIL +LINUX MAC : LayoutTests/fast/forms/input-baseline.html = FAIL LINUX MAC : LayoutTests/fast/forms/searchfield-heights.html = FAIL -MAC : LayoutTests/fast/forms/textfield-outline.html = FAIL +LINUX MAC : LayoutTests/fast/forms/textfield-outline.html = FAIL // Hebrew font metrics. LINUX : LayoutTests/fast/forms/select-visual-hebrew.html = FAIL @@ -1107,7 +1106,9 @@ LayoutTests/fast/forms/selection-functions.html = FAIL // MERGE REGRESSIONS 36102:37604 +WIN : LayoutTests/fast/css/line-height-overflow.html = FAIL LINUX : LayoutTests/fast/events/mouse-click-events.html = FAIL +WIN : LayoutTests/fast/flexbox/009.html = FAIL // The thumb in the scrollbar looks wrong. It looks too narrow. LayoutTests/fast/forms/form-element-geometry.html = FAIL // The list box selection is wrong, the focus ring is wrong, and the thumb in @@ -1129,6 +1130,7 @@ LINUX WIN : LayoutTests/fast/frames/onlyCommentInIFrame.html = FAIL LINUX WIN : LayoutTests/fast/frames/valid.html = FAIL LayoutTests/fast/invalid/residual-style.html = FAIL LayoutTests/fast/overflow/overflow-x-y.html = FAIL +WIN : LayoutTests/fast/overflow/unreachable-overflow-rtl-bug.html = FAIL LayoutTests/fast/parser/comment-in-textarea.html = FAIL LayoutTests/fast/parser/open-comment-in-textarea.html = FAIL // Linux pixeltest failure: We, with Windows, are failing to repaint correctly @@ -1148,6 +1150,7 @@ LayoutTests/fast/events/destroyed-atomic-string.html = FAIL LayoutTests/fast/js/global-constructors.html = FAIL LINUX WIN : LayoutTests/fast/layers/opacity-transforms.html = FAIL LayoutTests/fast/profiler = FAIL TIMEOUT +LINUX WIN : LayoutTests/fast/replaced/percent-height-in-anonymous-block-widget.html = FAIL LayoutTests/plugins/netscape-construct.html = FAIL // MERGE 37604:38097 REGRESSIONS @@ -1749,6 +1752,11 @@ MAC : LayoutTests/fast/reflections/reflection-overflow-hidden.html = PASS FAIL // Linux's rotated text output looks terrible. LINUX : LayoutTests/fast/transforms/transformed-document-element.html = FAIL +// Passes locally when run individually, but fails on buildbot. Could be a +// sideffect from previous test causing it to be flaky. Seems to have +// started with r7379 +WIN DEBUG : LayoutTests/editing/execCommand/paste-2.html = PASS FAIL + // Merge 39520:39606 -- new test. // Crashes on the buildbot reliably(?) but not locally, even under Valgrind. // NOTE: after crashes are worked out, this likely just needs to be @@ -1777,7 +1785,9 @@ LayoutTests/svg/custom/path-bad-data.svg = FAIL // Merge 39744:39829 - regressions WIN LINUX : LayoutTests/editing/pasteboard/4947130.html = FAIL WIN LINUX : LayoutTests/editing/selection/drag-text-delay.html = FAIL +WIN : LayoutTests/fast/events/space-scroll-event.html = FAIL +WIN : LayoutTests/fast/forms/enter-clicks-buttons.html = FAIL WIN : LayoutTests/http/tests/security/cross-frame-access-protocol-explicit-domain.html = FAIL WIN : LayoutTests/http/tests/security/cross-frame-access-protocol.html = FAIL @@ -1787,6 +1797,14 @@ LINUX : LayoutTests/tables/mozilla_expected_failures/marvin/table_overflow_dirty WIN : LayoutTests/tables/mozilla_expected_failures/marvin/table_overflow_dirty_reflow_tbody.html = FAIL PASS MAC : LayoutTests/tables/mozilla_expected_failures/marvin/table_overflow_dirty_reflow_tbody.html = FAIL PASS +// 12-Jan-2009 Regressions: +// I'm turning these off to green the build until I can look at them tomorrow. For the +// most part they probably just need to be rebaselined due to recent Skia SVG changes. +LINUX WIN : LayoutTests/fast/images/animated-svg-as-image.html = FAIL + +// Looks like this just needs a rebaseline. +LINUX WIN : LayoutTests/svg/custom/stroke-fallback.svg = FAIL + // Merge 39830:39880 - new tests LayoutTests/plugins/npruntime.html = TIMEOUT @@ -1859,9 +1877,16 @@ LINUX : LayoutTests/svg/W3C-SVG-1.1/animate-elem-15-t.svg = FAIL LINUX : LayoutTests/svg/custom/circular-marker-reference-3.svg = FAIL LINUX : LayoutTests/svg/custom/circular-marker-reference-4.svg = FAIL -// Merge 40086:40124 -- new test -// This needs layoutTestController.numberOfActiveAnimations implemented. -LayoutTests/transitions/repeated-firing-background-color.html = TIMEOUT +// TestShell change to dump() on notifyDone http://codereview.chromium.org/18440 +LayoutTests/fast/dom/Window/window-property-shadowing-name.html = FAIL +LayoutTests/fast/events/popup-blocking-click-in-iframe.html = FAIL +LayoutTests/http/tests/misc/timer-vs-loading.html = FAIL +LayoutTests/http/tests/xmlhttprequest/methods-async.html = FAIL +LayoutTests/plugins/npruntime.html = FAIL +LayoutTests/transitions/hang-with-bad-transition-list.html = FAIL +LayoutTests/fast/dom/Window/window-property-shadowing.html = TIMEOUT +LayoutTests/fast/events/programmatic-check-no-change-event.html = TIMEOUT +LayoutTests/http/tests/misc/uncacheable-script-repeated.html = TIMEOUT +LayoutTests/plugins/open-and-close-window-with-plugin.html = TIMEOUT +LayoutTests/transitions/inherit-other-props.html = TIMEOUT -// Merge 40086:40124 -- regression -LayoutTests/fast/forms/drag-into-textarea.html = FAIL diff --git a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj index 75df568..58e1540 100644 --- a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj +++ b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj @@ -2311,7 +2311,14 @@ ../../../../third_party/icu38/public/i18n, ../../../../third_party/npapi, ../../../pending, + ../../../port/bindings/v8, + ../../../../v8/include, ../../../../third_party/WebKit/WebCore/platform/chromium, + ../../../../third_party/WebKit/WebCore/platform/text, + ../../../../third_party/WebKit/WebCore/platform, + ../../../../third_party/WebKit/JavaScriptCore/wtf, + ../../../../third_party/WebKit/WebCore/dom, + ../../../../third_party/WebKit/WebCore/page, ../../../../third_party/WebKit/WebCore, ../../../../third_party/WebKit/WebKit/mac/WebCoreSupport, "$(SYMROOT)/webkit.build/$(CONFIGURATION)/generated/WebCore/v8", @@ -2347,7 +2354,14 @@ ../../../../third_party/icu38/public/i18n, ../../../../third_party/npapi, ../../../pending, + ../../../port/bindings/v8, + ../../../../v8/include, ../../../../third_party/WebKit/WebCore/platform/chromium, + ../../../../third_party/WebKit/WebCore/platform/text, + ../../../../third_party/WebKit/WebCore/platform, + ../../../../third_party/WebKit/JavaScriptCore/wtf, + ../../../../third_party/WebKit/WebCore/dom, + ../../../../third_party/WebKit/WebCore/page, ../../../../third_party/WebKit/WebCore, ../../../../third_party/WebKit/WebKit/mac/WebCoreSupport, "$(SYMROOT)/webkit.build/$(CONFIGURATION)/generated/WebCore/v8", diff --git a/webkit/tools/test_shell/mac/main.mm b/webkit/tools/test_shell/mac/main.mm index 535ac24..1f73d53 100644 --- a/webkit/tools/test_shell/mac/main.mm +++ b/webkit/tools/test_shell/mac/main.mm @@ -323,11 +323,13 @@ int main(const int argc, const char *argv[]) { continue; SetCurrentTestName(filenameBuffer); - if (!TestShell::RunFileTest(filenameBuffer, params)) + params.test_url = filenameBuffer; + if (!TestShell::RunFileTest(params)) break; } } else { - TestShell::RunFileTest(WideToUTF8(uri).c_str(), params); + params.test_url = WideToUTF8(uri).c_str(); + TestShell::RunFileTest(params); } } else { main_message_loop.Run(); diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index e5cd2d4..c1ae406 100755 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -2,8 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "v8_proxy.h" +#undef LOG + #include "webkit/tools/test_shell/test_shell.h" + #include "base/command_line.h" #include "base/debug_on_start.h" #include "base/file_path.h" @@ -95,6 +99,7 @@ TestShell::TestShell() #if defined(OS_WIN) default_edit_wnd_proc_(0), #endif + test_params_(NULL), test_is_preparing_(false), test_is_pending_(false), is_modal_(false), @@ -165,6 +170,72 @@ static void UnitTestAssertHandler(const std::string& str) { } // static +void TestShell::Dump(TestShell* shell) { + const TestParams* params = NULL; + if ((shell == NULL) || ((params = shell->test_params()) == NULL)) + return; + + WebCore::V8Proxy::ProcessConsoleMessages(); + // Echo the url in the output so we know we're not getting out of sync. + printf("#URL:%s\n", params->test_url.c_str()); + + // Dump the requested representation. + WebFrame* webFrame = shell->webView()->GetMainFrame(); + if (webFrame) { + bool should_dump_as_text = + shell->layout_test_controller_->ShouldDumpAsText(); + bool dumped_anything = false; + if (params->dump_tree) { + dumped_anything = true; + // Text output: the test page can request different types of output + // which we handle here. + if (!should_dump_as_text) { + // Plain text pages should be dumped as text + std::wstring mime_type = + webFrame->GetDataSource()->GetResponseMimeType(); + should_dump_as_text = (mime_type == L"text/plain"); + } + if (should_dump_as_text) { + bool recursive = shell->layout_test_controller_-> + ShouldDumpChildFramesAsText(); + std::string data_utf8 = WideToUTF8( + webkit_glue::DumpFramesAsText(webFrame, recursive)); + if (fwrite(data_utf8.c_str(), 1, data_utf8.size(), stdout) != + data_utf8.size()) { + LOG(FATAL) << "Short write to stdout, disk full?"; + } + } else { + printf("%s", WideToUTF8( + webkit_glue::DumpRenderer(webFrame)).c_str()); + + bool recursive = shell->layout_test_controller_-> + ShouldDumpChildFrameScrollPositions(); + printf("%s", WideToUTF8( + webkit_glue::DumpFrameScrollPosition(webFrame, recursive)).c_str()); + } + + if (shell->layout_test_controller_->ShouldDumpBackForwardList()) { + std::wstring bfDump; + DumpBackForwardList(&bfDump); + printf("%s", WideToUTF8(bfDump).c_str()); + } + } + + if (params->dump_pixels && !should_dump_as_text) { + // Image output: we write the image data to the file given on the + // command line (for the dump pixels argument), and the MD5 sum to + // stdout. + dumped_anything = true; + std::string md5sum = DumpImage(webFrame, params->pixel_file_name); + printf("#MD5:%s\n", md5sum.c_str()); + } + if (dumped_anything) + printf("#EOF\n"); + fflush(stdout); + } +} + +// static std::string TestShell::DumpImage(WebFrame* web_frame, const std::wstring& file_name) { scoped_ptr<skia::BitmapPlatformDevice> device; diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index d6afe61..0777ae0 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -64,6 +64,8 @@ public: // Filename we dump pixels to (when pixel testing is enabled). std::wstring pixel_file_name; + // URL of the test. + std::string test_url; }; TestShell(); @@ -194,14 +196,19 @@ public: // window JavaScript objects so they can be accessed by layout tests. virtual void BindJSObjectsToWindow(WebFrame* frame); - // Runs a layout test. Loads a single file into the first available - // window, then dumps the requested text representation to stdout. - // Returns false if the test cannot be run because no windows are open. - static bool RunFileTest(const char* filename, const TestParams& params); + // Runs a layout test. Loads a single file (specified in params.test_url) + // into the first available window, then dumps the requested text + // representation to stdout. Returns false if the test cannot be run + // because no windows are open. + static bool RunFileTest(const TestParams& params); // Writes the back-forward list data for every open window into result. static void DumpBackForwardList(std::wstring* result); + // Dumps the output from given test as text and/or image depending on + // the flags set. + static void Dump(TestShell* shell); + // Writes the image captured from the given web frame to the given file. // The returned string is the ASCII-ized MD5 sum of the image. static std::string DumpImage(WebFrame* web_frame, @@ -244,6 +251,11 @@ public: void set_is_modal(bool value) { is_modal_ = value; } bool is_modal() const { return is_modal_; } + const TestParams* test_params() { return test_params_; } + void set_test_params(const TestParams* test_params) { + test_params_ = test_params; + } + #if defined(OS_MACOSX) // handle cleaning up a shell given the associated window static void DestroyAssociatedShell(gfx::NativeWindow handle); @@ -288,8 +300,8 @@ private: // A set of all our windows. static WindowList* window_list_; #if defined(OS_MACOSX) - static base::LazyInstance<std::map<gfx::NativeWindow, TestShell *> > - window_map_; + typedef std::map<gfx::NativeWindow, TestShell *> WindowMap; + static base::LazyInstance<WindowMap> window_map_; #endif #if defined(OS_WIN) @@ -312,6 +324,8 @@ private: scoped_refptr<TestWebViewDelegate> delegate_; + const TestParams* test_params_; + // True while a test is preparing to run bool test_is_preparing_; diff --git a/webkit/tools/test_shell/test_shell.vsprops b/webkit/tools/test_shell/test_shell.vsprops index 5e6d0c8..e79c669 100644 --- a/webkit/tools/test_shell/test_shell.vsprops +++ b/webkit/tools/test_shell/test_shell.vsprops @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="8.00" Name="test_shell" - InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\webkit\build\webkit_common_includes.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\breakpad\using_breakpad.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\tools\grit\build\using_generated_resources.vsprops" + InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\webkit\build\webkit_common.vsprops;$(SolutionDir)..\third_party\libpng\using_libpng.vsprops;$(SolutionDir)..\breakpad\using_breakpad.vsprops;$(SolutionDir)..\third_party\libxml\build\using_libxml.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\tools\grit\build\using_generated_resources.vsprops" > <Tool Name="VCCLCompilerTool" diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 7d4bb01..4d8b908 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -376,6 +376,10 @@ void TestShell::TestFinished() { return; test_is_pending_ = false; + GtkWidget* window = *(TestShell::windowList()->begin()); + TestShell* shell = static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), + "test-shell")); + TestShell::Dump(shell); MessageLoop::current()->Quit(); } @@ -472,8 +476,7 @@ void TestShell::ResizeSubViews() { } } -/* static */ bool TestShell::RunFileTest(const char *filename, - const TestParams& params) { +/* static */ bool TestShell::RunFileTest(const TestParams& params) { // Load the test file into the first available window. if (TestShell::windowList()->empty()) { LOG(ERROR) << "No windows open."; @@ -509,74 +512,19 @@ void TestShell::ResizeSubViews() { shell->ResizeSubViews(); - if (strstr(filename, "loading/") || strstr(filename, "loading\\")) + if (strstr(params.test_url.c_str(), "loading/") || + strstr(params.test_url.c_str(), "loading\\")) shell->layout_test_controller()->SetShouldDumpFrameLoadCallbacks(true); shell->test_is_preparing_ = true; - const std::wstring wstr = UTF8ToWide(filename); + shell->set_test_params(¶ms); + std::wstring wstr = UTF8ToWide(params.test_url.c_str()); shell->LoadURL(wstr.c_str()); shell->test_is_preparing_ = false; shell->WaitTestFinished(); - - // Echo the url in the output so we know we're not getting out of sync. - printf("#URL:%s\n", filename); - - // Dump the requested representation. - WebFrame* webFrame = shell->webView()->GetMainFrame(); - if (webFrame) { - bool should_dump_as_text = - shell->layout_test_controller_->ShouldDumpAsText(); - bool dumped_anything = false; - if (params.dump_tree) { - dumped_anything = true; - // Text output: the test page can request different types of output - // which we handle here. - if (!should_dump_as_text) { - // Plain text pages should be dumped as text - std::wstring mime_type = webFrame->GetDataSource()->GetResponseMimeType(); - should_dump_as_text = (mime_type == L"text/plain"); - } - if (should_dump_as_text) { - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFramesAsText(); - std::string data_utf8 = WideToUTF8( - webkit_glue::DumpFramesAsText(webFrame, recursive)); - if (fwrite(data_utf8.c_str(), 1, data_utf8.size(), stdout) != - data_utf8.size()) { - LOG(FATAL) << "Short write to stdout, disk full?"; - } - } else { - printf("%s", WideToUTF8( - webkit_glue::DumpRenderer(webFrame)).c_str()); - - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFrameScrollPositions(); - printf("%s", WideToUTF8( - webkit_glue::DumpFrameScrollPosition(webFrame, recursive)). - c_str()); - } - - if (shell->layout_test_controller_->ShouldDumpBackForwardList()) { - std::wstring bfDump; - DumpBackForwardList(&bfDump); - printf("%s", WideToUTF8(bfDump).c_str()); - } - } - - if (params.dump_pixels && !should_dump_as_text) { - // Image output: we write the image data to the file given on the - // command line (for the dump pixels argument), and the MD5 sum to - // stdout. - dumped_anything = true; - std::string md5sum = DumpImage(webFrame, params.pixel_file_name); - printf("#MD5:%s\n", md5sum.c_str()); - } - if (dumped_anything) - printf("#EOF\n"); - fflush(stdout); - } + shell->set_test_params(NULL); return true; } @@ -709,7 +657,10 @@ std::string GetDataResource(int resource_id) { } bool GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { - return NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); + // TODO(port): Implement plugins someday. Don't let the error message + // of NOTIMPLEMENTED into our layout test diffs. + // NOTIMPLEMENTED(); + return false; } } // namespace webkit_glue diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index 99846a5..789fc4e 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -132,13 +132,13 @@ void TestShell::PlatformCleanUp() { // static void TestShell::DestroyAssociatedShell(gfx::NativeWindow handle) { - TestShell* shell = window_map_.Get()[handle]; - if (shell) { + WindowMap::iterator it = window_map_.Get().find(handle); + if (it != window_map_.Get().end()) { + delete it->second; window_map_.Get().erase(handle); } else { LOG(ERROR) << "Failed to find shell for window during destroy"; } - delete shell; } // static @@ -541,6 +541,10 @@ void TestShell::TestFinished() { 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); + if (it != window_map_.Get().end()) + TestShell::Dump(it->second); MessageLoop::current()->Quit(); } @@ -693,16 +697,15 @@ void TestShell::ResizeSubViews() { for (WindowList::iterator iter = TestShell::windowList()->begin(); iter != TestShell::windowList()->end(); iter++) { NSWindow* window = *iter; - TestShell* shell = window_map_.Get()[window]; - if (shell) - webkit_glue::DumpBackForwardList(shell->webView(), NULL, result); + WindowMap::iterator it = window_map_.Get().find(window); + if (it != window_map_.Get().end()) + webkit_glue::DumpBackForwardList(it->second->webView(), NULL, result); else LOG(ERROR) << "Failed to find shell for window during dump"; } } -/* static */ bool TestShell::RunFileTest(const char* filename, - const TestParams& params) { +/* static */ bool TestShell::RunFileTest(const TestParams& params) { // Load the test file into the first available window. if (TestShell::windowList()->empty()) { LOG(ERROR) << "No windows open."; @@ -738,71 +741,18 @@ void TestShell::ResizeSubViews() { [shell->m_mainWnd orderOut:nil]; shell->ResizeSubViews(); - if (strstr(filename, "loading/")) + if (strstr(params.test_url.c_str(), "loading/")) shell->layout_test_controller()->SetShouldDumpFrameLoadCallbacks(true); shell->test_is_preparing_ = true; - shell->LoadURL(UTF8ToWide(filename).c_str()); + shell->set_test_params(¶ms); + std::wstring wstr = UTF8ToWide(params.test_url.c_str()); + shell->LoadURL(wstr.c_str()); shell->test_is_preparing_ = false; shell->WaitTestFinished(); - - // Echo the url in the output so we know we're not getting out of sync. - printf("#URL:%s\n", filename); - - // Dump the requested representation. - WebFrame* webFrame = shell->webView()->GetMainFrame(); - if (webFrame) { - bool should_dump_as_text = - shell->layout_test_controller_->ShouldDumpAsText(); - bool dumped_anything = false; - if (params.dump_tree) { - dumped_anything = true; - // Text output: the test page can request different types of output - // which we handle here. - if (!should_dump_as_text) { - // Plain text pages should be dumped as text - std::string mime_type = - WideToUTF8(webFrame->GetDataSource()->GetResponseMimeType()); - should_dump_as_text = (mime_type == "text/plain"); - } - if (should_dump_as_text) { - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFramesAsText(); - printf("%s", WideToUTF8( - webkit_glue::DumpFramesAsText(webFrame, recursive)). - c_str()); - } else { - printf("%s", WideToUTF8( - webkit_glue::DumpRenderer(webFrame)).c_str()); - - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFrameScrollPositions(); - printf("%s", WideToUTF8( - webkit_glue::DumpFrameScrollPosition(webFrame, recursive)). - c_str()); - } - - if (shell->layout_test_controller_->ShouldDumpBackForwardList()) { - std::wstring bfDump; - DumpBackForwardList(&bfDump); - printf("%s", WideToUTF8(bfDump).c_str()); - } - } - - if (params.dump_pixels && !should_dump_as_text) { - // Image output: we write the image data to the file given on the - // command line (for the dump pixels argument), and the MD5 sum to - // stdout. - dumped_anything = true; - std::string md5sum = DumpImage(webFrame, params.pixel_file_name); - printf("#MD5:%s\n", md5sum.c_str()); - } - if (dumped_anything) - printf("#EOF\n"); - fflush(stdout); - } + shell->set_test_params(NULL); return true; } diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 3e4ecf3..3a52828 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -355,12 +355,13 @@ int main(int argc, char* argv[]) { if (!*filenameBuffer) continue; - - if (!TestShell::RunFileTest(filenameBuffer, params)) + params.test_url = filenameBuffer; + if (!TestShell::RunFileTest(params)) break; } } else { - TestShell::RunFileTest(WideToUTF8(uri).c_str(), params); + params.test_url = WideToUTF8(uri).c_str(); + TestShell::RunFileTest(params); } shell->CallJSGC(); diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index 2cce352..28fabc5 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -215,8 +215,8 @@ void TestShell::DumpBackForwardList(std::wstring* result) { } } -bool TestShell::RunFileTest(const char *filename, const TestParams& params) { - SetCurrentTestName(filename); +bool TestShell::RunFileTest(const TestParams& params) { + SetCurrentTestName(params.test_url.c_str()); // Load the test file into the first available window. if (TestShell::windowList()->empty()) { @@ -252,71 +252,19 @@ bool TestShell::RunFileTest(const char *filename, const TestParams& params) { SWP_NOSIZE | SWP_NOZORDER); shell->ResizeSubViews(); - if (strstr(filename, "loading/") || strstr(filename, "loading\\")) + if (strstr(params.test_url.c_str(), "loading/") || + strstr(params.test_url.c_str(), "loading\\")) shell->layout_test_controller()->SetShouldDumpFrameLoadCallbacks(true); shell->test_is_preparing_ = true; - - std::wstring wstr = UTF8ToWide(filename); + shell->set_test_params(¶ms); + std::wstring wstr = UTF8ToWide(params.test_url.c_str()); shell->LoadURL(wstr.c_str()); shell->test_is_preparing_ = false; shell->WaitTestFinished(); + shell->set_test_params(NULL); - // Echo the url in the output so we know we're not getting out of sync. - printf("#URL:%s\n", filename); - - // Dump the requested representation. - WebFrame* webFrame = shell->webView()->GetMainFrame(); - if (webFrame) { - bool should_dump_as_text = - shell->layout_test_controller_->ShouldDumpAsText(); - bool dumped_anything = false; - if (params.dump_tree) { - dumped_anything = true; - // Text output: the test page can request different types of output - // which we handle here. - if (!should_dump_as_text) { - // Plain text pages should be dumped as text - std::wstring mime_type = - webFrame->GetDataSource()->GetResponseMimeType(); - should_dump_as_text = (mime_type == L"text/plain"); - } - if (should_dump_as_text) { - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFramesAsText(); - std::string data_utf8 = WideToUTF8( - webkit_glue::DumpFramesAsText(webFrame, recursive)); - fwrite(data_utf8.c_str(), 1, data_utf8.size(), stdout); - } else { - printf("%s", WideToUTF8( - webkit_glue::DumpRenderer(webFrame)).c_str()); - - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFrameScrollPositions(); - printf("%s", WideToUTF8( - webkit_glue::DumpFrameScrollPosition(webFrame, recursive)).c_str()); - } - - if (shell->layout_test_controller_->ShouldDumpBackForwardList()) { - std::wstring bfDump; - DumpBackForwardList(&bfDump); - printf("%s", WideToUTF8(bfDump).c_str()); - } - } - - if (params.dump_pixels && !should_dump_as_text) { - // Image output: we write the image data to the file given on the - // command line (for the dump pixels argument), and the MD5 sum to - // stdout. - dumped_anything = true; - std::string md5sum = DumpImage(webFrame, params.pixel_file_name); - printf("#MD5:%s\n", md5sum.c_str()); - } - if (dumped_anything) - printf("#EOF\n"); - fflush(stdout); - } return true; } @@ -427,10 +375,15 @@ void TestShell::TestFinished() { if (!test_is_pending_) return; // reached when running under test_shell_tests + test_is_pending_ = false; + HWND hwnd = *(TestShell::windowList()->begin()); + TestShell* shell = + static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); + TestShell::Dump(shell); + UINT_PTR timer_id = reinterpret_cast<UINT_PTR>(this); KillTimer(mainWnd(), timer_id); - test_is_pending_ = false; MessageLoop::current()->Quit(); } |