diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-07 19:11:07 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-07 19:11:07 +0000 |
commit | 97096b165dccb3dbbbdb388a99b93c04a17ad98d (patch) | |
tree | 3154d4cd1ae648c66229b524b14d4dbfbee1b5e7 /webkit | |
parent | a349f6844cb7069d64cbb2883160f5ff035d9c59 (diff) | |
download | chromium_src-97096b165dccb3dbbbdb388a99b93c04a17ad98d.zip chromium_src-97096b165dccb3dbbbdb388a99b93c04a17ad98d.tar.gz chromium_src-97096b165dccb3dbbbdb388a99b93c04a17ad98d.tar.bz2 |
Remove some more DRT features from test_shell.
Specifically, remove the ability to run tests from the
command line and remove a bunch of methods that dump state.
Review URL: http://codereview.chromium.org/6334096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webkit_glue.cc | 15 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 121 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 119 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller_unittest.cc | 44 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 165 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 46 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 64 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_mac.mm | 57 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 77 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 171 |
11 files changed, 4 insertions, 878 deletions
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index 1138e86..6d76c71 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -240,21 +240,6 @@ string16 DumpHistoryState(const std::string& history_state, int indent, is_current)); } -void ResetBeforeTestRun(WebView* view) { - WebFrame* web_frame = view->mainFrame(); - - // Reset the main frame name since tests always expect it to be empty. It - // is normally not reset between page loads (even in IE and FF). - if (web_frame) - web_frame->setName(WebString()); - -#if defined(OS_WIN) - // Reset the last click information so the clicks generated from previous - // test aren't inherited (otherwise can mistake single/double/triple clicks) - WebKit::WebInputEventFactory::resetLastClickState(); -#endif -} - #ifndef NDEBUG // The log macro was having problems due to collisions with WTF, so we just // code here what that would have inlined. diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index c138c28..5df2aea 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -90,9 +90,6 @@ string16 DumpFrameScrollPosition(WebKit::WebFrame* web_frame, bool recursive); string16 DumpHistoryState(const std::string& history_state, int indent, bool is_current); -// Cleans up state left over from the previous test run. -void ResetBeforeTestRun(WebKit::WebView* view); - // Returns the WebKit version (major.minor). std::string GetWebKitVersion(); diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 3a517b8..6a55e1a 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -61,18 +61,6 @@ using WebKit::WebURL; TestShell* LayoutTestController::shell_ = NULL; // Most of these flags need to be cleared in Reset() so that they get turned // off between each test run. -bool LayoutTestController::generate_pixel_results_ = true; -bool LayoutTestController::dump_as_text_ = false; -bool LayoutTestController::dump_editing_callbacks_ = false; -bool LayoutTestController::dump_frame_load_callbacks_ = false; -bool LayoutTestController::dump_resource_load_callbacks_ = false; -bool LayoutTestController::dump_resource_response_mime_types_ = false; -bool LayoutTestController::dump_back_forward_list_ = false; -bool LayoutTestController::dump_child_frame_scroll_positions_ = false; -bool LayoutTestController::dump_child_frames_as_text_ = false; -bool LayoutTestController::dump_window_status_changes_ = false; -bool LayoutTestController::dump_title_changes_ = false; -bool LayoutTestController::dump_selection_rect_ = false; bool LayoutTestController::accepts_editing_ = true; bool LayoutTestController::wait_until_done_ = false; bool LayoutTestController::can_open_windows_ = false; @@ -97,17 +85,6 @@ LayoutTestController::LayoutTestController(TestShell* shell) : // they will use when called by JavaScript. The actual binding of those // names to their methods will be done by calling BindToJavaScript() (defined // by CppBoundClass, the parent to LayoutTestController). - BindMethod("dumpAsText", &LayoutTestController::dumpAsText); - BindMethod("dumpChildFrameScrollPositions", &LayoutTestController::dumpChildFrameScrollPositions); - BindMethod("dumpChildFramesAsText", &LayoutTestController::dumpChildFramesAsText); - BindMethod("dumpDatabaseCallbacks", &LayoutTestController::dumpDatabaseCallbacks); - BindMethod("dumpEditingCallbacks", &LayoutTestController::dumpEditingCallbacks); - BindMethod("dumpBackForwardList", &LayoutTestController::dumpBackForwardList); - BindMethod("dumpFrameLoadCallbacks", &LayoutTestController::dumpFrameLoadCallbacks); - BindMethod("dumpResourceLoadCallbacks", &LayoutTestController::dumpResourceLoadCallbacks); - BindMethod("dumpResourceResponseMIMETypes", &LayoutTestController::dumpResourceResponseMIMETypes); - BindMethod("dumpStatusCallbacks", &LayoutTestController::dumpWindowStatusChanges); - BindMethod("dumpTitleChanges", &LayoutTestController::dumpTitleChanges); BindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing); BindMethod("waitUntilDone", &LayoutTestController::waitUntilDone); BindMethod("notifyDone", &LayoutTestController::notifyDone); @@ -163,14 +140,12 @@ LayoutTestController::LayoutTestController(TestShell* shell) : BindMethod("addUserStyleSheet", &LayoutTestController::addUserStyleSheet); BindMethod("pageNumberForElementById", &LayoutTestController::pageNumberForElementById); BindMethod("numberOfPages", &LayoutTestController::numberOfPages); - BindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect); BindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission); BindMethod("setDomainRelaxationForbiddenForURLScheme", &LayoutTestController::setDomainRelaxationForbiddenForURLScheme); BindMethod("sampleSVGAnimationForElementAtTime", &LayoutTestController::sampleSVGAnimationForElementAtTime); BindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker); // The following are stubs. - BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); BindMethod("setMainFrameIsFirstResponder", &LayoutTestController::setMainFrameIsFirstResponder); BindMethod("display", &LayoutTestController::display); BindMethod("testRepaint", &LayoutTestController::testRepaint); @@ -272,75 +247,6 @@ void LayoutTestController::WorkQueue::AddWork(WorkItem* work) { queue_.push(work); } -void LayoutTestController::dumpAsText(const CppArgumentList& args, - CppVariant* result) { - dump_as_text_ = true; - generate_pixel_results_ = false; - if (args.size() > 0 && args[0].isBool()) - generate_pixel_results_ = args[0].value.boolValue; - result->SetNull(); -} - -void LayoutTestController::dumpDatabaseCallbacks( - const CppArgumentList& args, CppVariant* result) { - // Do nothing; we don't use this flag anywhere for now - result->SetNull(); -} - -void LayoutTestController::dumpEditingCallbacks( - const CppArgumentList& args, CppVariant* result) { - dump_editing_callbacks_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpBackForwardList( - const CppArgumentList& args, CppVariant* result) { - dump_back_forward_list_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpFrameLoadCallbacks( - const CppArgumentList& args, CppVariant* result) { - dump_frame_load_callbacks_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpResourceLoadCallbacks( - const CppArgumentList& args, CppVariant* result) { - dump_resource_load_callbacks_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpResourceResponseMIMETypes( - const CppArgumentList& args, CppVariant* result) { - dump_resource_response_mime_types_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpChildFrameScrollPositions( - const CppArgumentList& args, CppVariant* result) { - dump_child_frame_scroll_positions_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpChildFramesAsText( - const CppArgumentList& args, CppVariant* result) { - dump_child_frames_as_text_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpWindowStatusChanges( - const CppArgumentList& args, CppVariant* result) { - dump_window_status_changes_ = true; - result->SetNull(); -} - -void LayoutTestController::dumpTitleChanges( - const CppArgumentList& args, CppVariant* result) { - dump_title_changes_ = true; - result->SetNull(); -} - void LayoutTestController::setAcceptsEditing( const CppArgumentList& args, CppVariant* result) { if (args.size() > 0 && args[0].isBool()) @@ -522,10 +428,6 @@ void LayoutTestController::Reset() { // Reset editingBehavior to a reasonable default between tests // see http://trac.webkit.org/changeset/60158 - // DumpRenderTree resets this in TestShell::resetWebSettings() - // called in TestShell::resetTestController(). - // test_shell doesn't have ResetWebSettings(), so do this here, - // which is also called in TestShell::ResetTestController(). #if defined(OS_MACOSX) shell_->webView()->settings()->setEditingBehavior( WebKit::WebSettings::EditingBehaviorMac); @@ -534,18 +436,6 @@ void LayoutTestController::Reset() { WebKit::WebSettings::EditingBehaviorWin); #endif } - generate_pixel_results_ = true; - dump_as_text_ = false; - dump_editing_callbacks_ = false; - dump_frame_load_callbacks_ = false; - dump_resource_load_callbacks_ = false; - dump_resource_response_mime_types_ = false; - dump_back_forward_list_ = false; - dump_child_frame_scroll_positions_ = false; - dump_child_frames_as_text_ = false; - dump_window_status_changes_ = false; - dump_selection_rect_ = false; - dump_title_changes_ = false; accepts_editing_ = true; wait_until_done_ = false; can_open_windows_ = false; @@ -998,22 +888,11 @@ void LayoutTestController::sampleSVGAnimationForElementAtTime( // Unimplemented stubs // -void LayoutTestController::dumpAsWebArchive( - const CppArgumentList& args, CppVariant* result) { - result->SetNull(); -} - void LayoutTestController::setMainFrameIsFirstResponder( const CppArgumentList& args, CppVariant* result) { result->SetNull(); } -void LayoutTestController::dumpSelectionRect( - const CppArgumentList& args, CppVariant* result) { - dump_selection_rect_ = true; - result->SetNull(); -} - void LayoutTestController::display( const CppArgumentList& args, CppVariant* result) { WebViewHost* view_host = shell_->webViewHost(); diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 1b92fe1..a83bc94 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -29,46 +29,6 @@ class LayoutTestController : public CppBoundClass { LayoutTestController(TestShell* shell); ~LayoutTestController(); - // This function sets a flag that tells the test_shell to dump pages as - // plain text, rather than as a text representation of the renderer's state. - // It takes no arguments, and ignores any that may be present. - void dumpAsText(const CppArgumentList& args, CppVariant* result); - - // This function should set a flag that tells the test_shell to print a line - // of descriptive text for each database command. It should take no - // arguments, and ignore any that may be present. However, at the moment, we - // don't have any DB function that prints messages, so for now this function - // doesn't do anything. - void dumpDatabaseCallbacks(const CppArgumentList& args, CppVariant* result); - - // This function sets a flag that tells the test_shell to print a line of - // descriptive text for each editing command. It takes no arguments, and - // ignores any that may be present. - void dumpEditingCallbacks(const CppArgumentList& args, CppVariant* result); - - // This function sets a flag that tells the test_shell to print a line of - // descriptive text for each frame load callback. It takes no arguments, and - // ignores any that may be present. - void dumpFrameLoadCallbacks(const CppArgumentList& args, CppVariant* result); - - // This function sets a flag that tells the test_shell to print out a text - // representation of the back/forward list. It ignores all args. - void dumpBackForwardList(const CppArgumentList& args, CppVariant* result); - - // This function sets a flag that tells the test_shell to print out the - // scroll offsets of the child frames. It ignores all args. - void dumpChildFrameScrollPositions(const CppArgumentList& args, CppVariant* result); - - // This function sets a flag that tells the test_shell to recursively - // dump all frames as plain text if the dumpAsText flag is set. - // It takes no arguments, and ignores any that may be present. - void dumpChildFramesAsText(const CppArgumentList& args, CppVariant* result); - - // This function sets a flag that tells the test_shell to dump all calls - // to window.status(). - // It takes no arguments, and ignores any that may be present. - void dumpWindowStatusChanges(const CppArgumentList& args, CppVariant* result); - // When called with a boolean argument, this sets a flag that controls // whether content-editable elements accept editing focus when an editing // attempt is made. It ignores any additional arguments. @@ -195,8 +155,6 @@ class LayoutTestController : public CppBoundClass { void setIconDatabaseEnabled(const CppArgumentList& args, CppVariant* result); - void dumpSelectionRect(const CppArgumentList& args, CppVariant* result); - // Grants permission for desktop notifications to an origin void grantDesktopNotificationPermission(const CppArgumentList& args, CppVariant* result); @@ -209,10 +167,6 @@ class LayoutTestController : public CppBoundClass { // The following are only stubs. TODO(pamg): Implement any of these that // are needed to pass the layout tests. - void dumpAsWebArchive(const CppArgumentList& args, CppVariant* result); - void dumpTitleChanges(const CppArgumentList& args, CppVariant* result); - void dumpResourceLoadCallbacks(const CppArgumentList& args, CppVariant* result); - void dumpResourceResponseMIMETypes(const CppArgumentList& args, CppVariant* result); void setMainFrameIsFirstResponder(const CppArgumentList& args, CppVariant* result); void display(const CppArgumentList& args, CppVariant* result); void testRepaint(const CppArgumentList& args, CppVariant* result); @@ -308,33 +262,6 @@ class LayoutTestController : public CppBoundClass { // The following methods are not exposed to JavaScript. void SetWorkQueueFrozen(bool frozen) { work_queue_.set_frozen(frozen); } - bool ShouldDumpAsText() { return dump_as_text_; } - bool ShouldGeneratePixelResults() { return generate_pixel_results_; } - bool ShouldDumpEditingCallbacks() { return dump_editing_callbacks_; } - bool ShouldDumpFrameLoadCallbacks() { return dump_frame_load_callbacks_; } - void SetShouldDumpFrameLoadCallbacks(bool value) { - dump_frame_load_callbacks_ = value; - } - bool ShouldDumpResourceLoadCallbacks() { - return dump_resource_load_callbacks_; - } - bool ShouldDumpResourceResponseMIMETypes() { - return dump_resource_response_mime_types_; - } - bool ShouldDumpStatusCallbacks() { - return dump_window_status_changes_; - } - bool ShouldDumpSelectionRect() { - return dump_selection_rect_; - } - bool ShouldDumpBackForwardList() { return dump_back_forward_list_; } - bool ShouldDumpTitleChanges() { return dump_title_changes_; } - bool ShouldDumpChildFrameScrollPositions() { - return dump_child_frame_scroll_positions_; - } - bool ShouldDumpChildFramesAsText() { - return dump_child_frames_as_text_; - } bool AcceptsEditing() { return accepts_editing_; } bool CanOpenWindows() { return can_open_windows_; } bool ShouldAddFileToPasteboard() { return should_add_file_to_pasteboard_; } @@ -410,52 +337,6 @@ class LayoutTestController : public CppBoundClass { // Non-owning pointer. The LayoutTestController is owned by the host. static TestShell* shell_; - // If true, the test_shell will produce a plain text dump rather than a - // text representation of the renderer. - static bool dump_as_text_; - - // If true, dump pixel results. This can be true even if - // dump_as_text_ is true. - static bool generate_pixel_results_; - - // If true, the test_shell will write a descriptive line for each editing - // command. - static bool dump_editing_callbacks_; - - // If true, the test_shell will draw the bounds of the current selection rect - // taking possible transforms of the selection rect into account. - static bool dump_selection_rect_; - - // If true, the test_shell will output a descriptive line for each frame - // load callback. - static bool dump_frame_load_callbacks_; - - // If true, the test_shell will output a descriptive line for each resource - // load callback. - static bool dump_resource_load_callbacks_; - - // If true, the test_shell will output a line with the MIME type for each - // resource that is loaded. - static bool dump_resource_response_mime_types_; - - // If true, the test_shell will produce a dump of the back forward list as - // well. - static bool dump_back_forward_list_; - - // If true, the test_shell will print out the child frame scroll offsets as - // well. - static bool dump_child_frame_scroll_positions_; - - // If true and if dump_as_text_ is true, the test_shell will recursively - // dump all frames as plain text. - static bool dump_child_frames_as_text_; - - // If true, the test_shell will dump all changes to window.status. - static bool dump_window_status_changes_; - - // If true, output a message when the page title is changed. - static bool dump_title_changes_; - // If true, the element will be treated as editable. This value is returned // from various editing callbacks that are called just before edit operations // are allowed. diff --git a/webkit/tools/test_shell/layout_test_controller_unittest.cc b/webkit/tools/test_shell/layout_test_controller_unittest.cc index cf10e29..bb4c4c1 100644 --- a/webkit/tools/test_shell/layout_test_controller_unittest.cc +++ b/webkit/tools/test_shell/layout_test_controller_unittest.cc @@ -29,10 +29,8 @@ class LayoutTestControllerTest : public testing::Test { TEST(LayoutTestControllerTest, MethodMapIsInitialized) { const char* test_methods[] = { - "dumpAsText", "waitUntilDone", "notifyDone", - "dumpEditingCallbacks", "queueLoad", "windowCount", NULL @@ -45,45 +43,3 @@ TEST(LayoutTestControllerTest, MethodMapIsInitialized) { // One more case, to test our test. EXPECT_FALSE(controller.IsMethodRegistered("nonexistent_method")); } - -TEST(LayoutTestControllerTest, DumpAsTextSetAndCleared) { - TestLayoutTestController controller; - CppArgumentList empty_args; - CppVariant ignored_result; - EXPECT_FALSE(controller.ShouldDumpAsText()); - controller.dumpAsText(empty_args, &ignored_result); - EXPECT_TRUE(ignored_result.isNull()); - EXPECT_TRUE(controller.ShouldDumpAsText()); - - // Don't worry about closing remaining windows when we call reset. - CppArgumentList args; - CppVariant bool_false; - bool_false.Set(false); - args.push_back(bool_false); - CppVariant result; - controller.setCloseRemainingWindowsWhenComplete(args, &result); - - controller.Reset(); - EXPECT_FALSE(controller.ShouldDumpAsText()); -} - -TEST(LayoutTestControllerTest, DumpChildFramesAsTextSetAndCleared) { - TestLayoutTestController controller; - CppArgumentList empty_args; - CppVariant ignored_result; - EXPECT_FALSE(controller.ShouldDumpChildFramesAsText()); - controller.dumpChildFramesAsText(empty_args, &ignored_result); - EXPECT_TRUE(ignored_result.isNull()); - EXPECT_TRUE(controller.ShouldDumpChildFramesAsText()); - - // Don't worry about closing remaining windows when we call reset. - CppArgumentList args; - CppVariant bool_false; - bool_false.Set(false); - args.push_back(bool_false); - CppVariant result; - controller.setCloseRemainingWindowsWhenComplete(args, &result); - - controller.Reset(); - EXPECT_FALSE(controller.ShouldDumpChildFramesAsText()); -} diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 8c9c1e1..b47daa6 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -116,7 +116,6 @@ bool TestShell::test_is_preparing_ = false; bool TestShell::test_is_pending_ = false; int TestShell::load_count_ = 1; std::vector<std::string> TestShell::js_flags_; -bool TestShell::dump_when_finished_ = true; bool TestShell::accelerated_2d_canvas_enabled_ = false; bool TestShell::accelerated_compositing_enabled_ = false; @@ -222,165 +221,6 @@ 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; - - WebScriptController::flushConsoleMessages(); - - // Dump the requested representation. - WebFrame* frame = shell->webView()->mainFrame(); - if (frame) { - bool should_dump_as_text = - shell->layout_test_controller_->ShouldDumpAsText(); - bool should_generate_pixel_results = - shell->layout_test_controller()->ShouldGeneratePixelResults(); - 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 - const string16& mime_type = - frame->dataSource()->response().mimeType(); - if (EqualsASCII(mime_type, "text/plain")) { - should_dump_as_text = true; - should_generate_pixel_results = false; - } - } - if (should_dump_as_text) { - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFramesAsText(); - std::string data_utf8 = UTF16ToUTF8( - webkit_glue::DumpFramesAsText(frame, 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", UTF16ToUTF8( - webkit_glue::DumpRenderer(frame)).c_str()); - - bool recursive = shell->layout_test_controller_-> - ShouldDumpChildFrameScrollPositions(); - printf("%s", UTF16ToUTF8( - webkit_glue::DumpFrameScrollPosition(frame, recursive)).c_str()); - } - - if (shell->layout_test_controller_->ShouldDumpBackForwardList()) { - string16 bfDump; - DumpAllBackForwardLists(&bfDump); - printf("%s", UTF16ToUTF8(bfDump).c_str()); - } - } - - if (params->dump_pixels && should_generate_pixel_results) { - // 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; - WebViewHost* view_host = shell->webViewHost(); - view_host->webview()->layout(); - if (shell->layout_test_controller()->test_repaint()) { - WebSize view_size = view_host->webview()->size(); - int width = view_size.width; - int height = view_size.height; - if (shell->layout_test_controller()->sweep_horizontally()) { - for (gfx::Rect column(0, 0, 1, height); column.x() < width; - column.Offset(1, 0)) { - view_host->PaintRect(column); - } - } else { - for (gfx::Rect line(0, 0, width, 1); line.y() < height; - line.Offset(0, 1)) { - view_host->PaintRect(line); - } - } - } else { - view_host->Paint(); - } - - // See if we need to draw the selection bounds rect. Selection bounds - // rect is the rect enclosing the (possibly transformed) selection. - // The rect should be drawn after everything is laid out and painted. - if (shell->layout_test_controller_->ShouldDumpSelectionRect()) { - // If there is a selection rect - draw a red 1px border enclosing rect - WebRect wr = frame->selectionBoundsRect(); - if (!wr.isEmpty()) { - // Render a red rectangle bounding selection rect - SkPaint paint; - paint.setColor(0xFFFF0000); // Fully opaque red - paint.setStyle(SkPaint::kStroke_Style); - paint.setFlags(SkPaint::kAntiAlias_Flag); - paint.setStrokeWidth(1.0f); - SkIRect rect; // Bounding rect - rect.set(wr.x, wr.y, wr.x + wr.width, wr.y + wr.height); - view_host->canvas()->drawIRect(rect, paint); - } - } - - std::string md5sum = DumpImage(view_host->canvas(), - params->pixel_file_name, params->pixel_hash); - printf("#MD5:%s\n", md5sum.c_str()); - } - if (dumped_anything) - printf("#EOF\n"); - fflush(stdout); - } -} - -// static -std::string TestShell::DumpImage(skia::PlatformCanvas* canvas, - const FilePath& path, const std::string& pixel_hash) { - skia::BitmapPlatformDevice& device = - static_cast<skia::BitmapPlatformDevice&>(canvas->getTopPlatformDevice()); - const SkBitmap& src_bmp = device.accessBitmap(false); - - // Encode image. - std::vector<unsigned char> png; - SkAutoLockPixels src_bmp_lock(src_bmp); - gfx::PNGCodec::ColorFormat color_format = gfx::PNGCodec::FORMAT_BGRA; - - // Fix the alpha. The expected PNGs on Mac have an alpha channel, so we want - // to keep it. On Windows, the alpha channel is wrong since text/form control - // drawing may have erased it in a few places. So on Windows we force it to - // opaque and also don't write the alpha channel for the reference. Linux - // doesn't have the wrong alpha like Windows, but we try to match Windows. -#if defined(OS_MACOSX) - bool discard_transparency = false; -#else - bool discard_transparency = true; - device.makeOpaque(0, 0, src_bmp.width(), src_bmp.height()); -#endif - - // Compute MD5 sum. - MD5Context ctx; - MD5Init(&ctx); - MD5Update(&ctx, src_bmp.getPixels(), src_bmp.getSize()); - - MD5Digest digest; - MD5Final(&digest, &ctx); - std::string md5hash = MD5DigestToBase16(digest); - - // Only encode and dump the png if the hashes don't match. Encoding the image - // is really expensive. - if (md5hash.compare(pixel_hash) != 0) { - gfx::PNGCodec::Encode( - reinterpret_cast<const unsigned char*>(src_bmp.getPixels()), - color_format, src_bmp.width(), src_bmp.height(), - static_cast<int>(src_bmp.rowBytes()), discard_transparency, &png); - - // Write to disk. - file_util::WriteFile(path, reinterpret_cast<const char *>(&png[0]), - png.size()); - } - - return md5hash; -} - -// static void TestShell::InitLogging(bool suppress_error_dialogs, bool layout_test_mode, bool enable_gp_fault_error_box) { @@ -646,11 +486,6 @@ void TestShell::LoadFile(const FilePath& file) { } void TestShell::LoadURL(const GURL& url) { - // Used as a sentinal for run_webkit_tests.py to know when to start reading - // test output for this test and so we know we're not getting out of sync. - if (layout_test_mode_ && dump_when_finished_ && test_params()) - printf("#URL:%s\n", test_params()->test_url.c_str()); - LoadURLForFrame(url, std::wstring()); } diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 77fd031..9cd3b98 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -174,26 +174,6 @@ public: // Passes options from LayoutTestController through to the delegate (or // any other caller). - bool ShouldDumpEditingCallbacks() { - return layout_test_mode_ && - layout_test_controller_->ShouldDumpEditingCallbacks(); - } - bool ShouldDumpFrameLoadCallbacks() { - return layout_test_mode_ && (test_is_preparing_ || test_is_pending_) && - layout_test_controller_->ShouldDumpFrameLoadCallbacks(); - } - bool ShouldDumpResourceLoadCallbacks() { - return layout_test_mode_ && (test_is_preparing_ || test_is_pending_) && - layout_test_controller_->ShouldDumpResourceLoadCallbacks(); - } - bool ShouldDumpResourceResponseMIMETypes() { - return layout_test_mode_ && (test_is_preparing_ || test_is_pending_) && - layout_test_controller_->ShouldDumpResourceResponseMIMETypes(); - } - bool ShouldDumpTitleChanges() { - return layout_test_mode_ && - layout_test_controller_->ShouldDumpTitleChanges(); - } bool AcceptsEditing() { return layout_test_controller_->AcceptsEditing(); } @@ -242,12 +222,6 @@ public: // window JavaScript objects so they can be accessed by layout tests. virtual void BindJSObjectsToWindow(WebKit::WebFrame* frame); - // 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. // Should call DumpBackForwardListOfWindow on each TestShell window. static void DumpAllBackForwardLists(string16* result); @@ -258,16 +232,6 @@ public: // Writes the back-forward list data for this test shell into result. void DumpBackForwardList(string16* 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(skia::PlatformCanvas* canvas, - const FilePath& path, - const std::string& pixel_hash); - static void ResetWebPreferences(); static void SetAllowScriptsToCloseWindows(); @@ -316,13 +280,6 @@ public: return js_flags_[load]; } - // Set whether to dump when the loaded page has finished processing. This is - // used with multiple load testing where normally we only want to have the - // output from the last load. - static void SetDumpWhenFinished(bool dump_when_finished) { - dump_when_finished_ = dump_when_finished; - } - #if defined(OS_WIN) // Access to the finished event. Used by the static WatchDog // thread. @@ -462,9 +419,6 @@ private: // of each URL. static std::vector<std::string> js_flags_; - // True if a test shell dump should be made when the test is finished. - static bool dump_when_finished_; - // True if we're testing the accelerated canvas 2d path. static bool accelerated_2d_canvas_enabled_; diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 8c5e7a1..9f8ec9d 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -376,12 +376,6 @@ void TestShell::TestFinished() { return; test_is_pending_ = false; - if (dump_when_finished_) { - GtkWindow* window = *(TestShell::windowList()->begin()); - TestShell* shell = static_cast<TestShell*>( - g_object_get_data(G_OBJECT(window), "test-shell")); - TestShell::Dump(shell); - } MessageLoop::current()->Quit(); } @@ -499,64 +493,6 @@ void TestShell::ResizeSubViews() { } } -/* 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."; - return false; - } - - GtkWindow* window = *(TestShell::windowList()->begin()); - TestShell* shell = - static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), - "test-shell")); - - // Clear focus between tests. - shell->m_focusedWidgetHost = NULL; - - // Make sure the previous load is stopped. - shell->webView()->mainFrame()->stopLoading(); - shell->navigation_controller()->Reset(); - - // StopLoading may update state maintained in the test controller (for - // example, whether the WorkQueue is frozen) as such, we need to reset it - // after we invoke StopLoading. - shell->ResetTestController(); - - // ResetTestController may have closed the window we were holding on to. - // Grab the first window again. - window = *(TestShell::windowList()->begin()); - shell = static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), - "test-shell")); - DCHECK(shell); - - // Clean up state between test runs. - webkit_glue::ResetBeforeTestRun(shell->webView()); - ResetWebPreferences(); - web_prefs_->Apply(shell->webView()); - - // TODO(agl): Maybe make the window hidden in the future. Window does this - // by positioning it off the screen but the GTK function to do this is - // deprecated and appears to have been removed. - - shell->ResizeSubViews(); - - 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; - - shell->set_test_params(¶ms); - shell->LoadURL(GURL(params.test_url)); - - shell->test_is_preparing_ = false; - shell->WaitTestFinished(); - shell->set_test_params(NULL); - - return true; -} - void TestShell::LoadURLForFrame(const GURL& url, const std::wstring& frame_name) { if (!url.is_valid()) diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index b56121e..d001212 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -370,12 +370,6 @@ void TestShell::TestFinished() { return; // reached when running under test_shell_tests test_is_pending_ = false; - if (dump_when_finished_) { - 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(); } @@ -537,57 +531,6 @@ void TestShell::ResizeSubViews() { } } -/* 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."; - return false; - } - - NSWindow* window = *(TestShell::windowList()->begin()); - TestShell* shell = window_map_.Get()[window]; - DCHECK(shell); - shell->ResetTestController(); - - // 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]; - DCHECK(shell); - - // Clear focus between tests. - shell->m_focusedWidgetHost = NULL; - - // Make sure the previous load is stopped. - shell->webView()->mainFrame()->stopLoading(); - shell->navigation_controller()->Reset(); - - // Clean up state between test runs. - webkit_glue::ResetBeforeTestRun(shell->webView()); - ResetWebPreferences(); - web_prefs_->Apply(shell->webView()); - - // Hide the window. We can't actually use NSWindow's |-setFrameTopLeftPoint:| - // because it leaves a chunk of the window visible instead of moving it - // offscreen. - [shell->m_mainWnd orderOut:nil]; - shell->ResizeSubViews(); - - if (strstr(params.test_url.c_str(), "loading/")) - shell->layout_test_controller()->SetShouldDumpFrameLoadCallbacks(true); - - shell->test_is_preparing_ = true; - - shell->set_test_params(¶ms); - shell->LoadURL(GURL(params.test_url)); - - shell->test_is_preparing_ = false; - shell->WaitTestFinished(); - shell->set_test_params(NULL); - - return true; -} - void TestShell::LoadURLForFrame(const GURL& url, const std::wstring& frame_name) { if (!url.is_valid()) diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index a7c4d94..185b1736 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -233,77 +233,6 @@ void TestShell::DumpAllBackForwardLists(string16* result) { } } -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()) { - LOG(ERROR) << "No windows open."; - return false; - } - - HWND hwnd = *(TestShell::windowList()->begin()); - TestShell* shell = - static_cast<TestShell*>(ui::GetWindowUserData(hwnd)); - - // Clear focus between tests. - shell->m_focusedWidgetHost = NULL; - - // Make sure the previous load is stopped. - shell->webView()->mainFrame()->stopLoading(); - shell->navigation_controller()->Reset(); - - // StopLoading may update state maintained in the test controller (for - // example, whether the WorkQueue is frozen) as such, we need to reset it - // after we invoke StopLoading. - shell->ResetTestController(); - - // ResetTestController may have closed the window we were holding on to. - // Grab the first window again. - hwnd = *(TestShell::windowList()->begin()); - shell = static_cast<TestShell*>(ui::GetWindowUserData(hwnd)); - DCHECK(shell); - - // Whether DevTools should be open before loading the page. - bool inspector_test_mode = strstr(params.test_url.c_str(), "/inspector/") || - strstr(params.test_url.c_str(), "\\inspector\\"); - - developer_extras_enabled_ = inspector_test_mode || - strstr(params.test_url.c_str(), "/inspector-enabled/") || - strstr(params.test_url.c_str(), "\\inspector-enabled\\"); - - // Clean up state between test runs. - webkit_glue::ResetBeforeTestRun(shell->webView()); - ResetWebPreferences(); - web_prefs_->Apply(shell->webView()); - - SetWindowPos(shell->m_mainWnd, NULL, - kTestWindowXLocation, kTestWindowYLocation, 0, 0, - SWP_NOSIZE | SWP_NOZORDER); - shell->ResizeSubViews(); - - if (strstr(params.test_url.c_str(), "loading/") || - strstr(params.test_url.c_str(), "loading\\")) - shell->layout_test_controller()->SetShouldDumpFrameLoadCallbacks(true); - - if (inspector_test_mode) - shell->ShowDevTools(); - - GURL url(params.test_url); - if (url.is_valid()) { // Don't hang if we have an invalid path. - shell->test_is_preparing_ = true; - shell->set_test_params(¶ms); - shell->LoadURL(url); - shell->test_is_preparing_ = false; - shell->WaitTestFinished(); - shell->set_test_params(NULL); - } else { - NOTREACHED() << "Invalid url: " << url.spec(); - } - - return true; -} - std::string TestShell::RewriteLocalUrl(const std::string& url) { // Convert file:///tmp/LayoutTests urls to the actual location on disk. const char kPrefix[] = "file:///tmp/LayoutTests/"; @@ -432,12 +361,6 @@ void TestShell::TestFinished() { return; // reached when running under test_shell_tests test_is_pending_ = false; - if (dump_when_finished_) { - HWND hwnd = *(TestShell::windowList()->begin()); - TestShell* shell = - static_cast<TestShell*>(ui::GetWindowUserData(hwnd)); - TestShell::Dump(shell); - } UINT_PTR timer_id = reinterpret_cast<UINT_PTR>(this); KillTimer(mainWnd(), timer_id); diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 8c571ce..8bfcf22 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -391,44 +391,22 @@ void TestWebViewDelegate::didStopLoading() { // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. bool TestWebViewDelegate::shouldBeginEditing(const WebRange& range) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", - GetRangeDescription(range).c_str()); - } return shell_->AcceptsEditing(); } bool TestWebViewDelegate::shouldEndEditing(const WebRange& range) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", - GetRangeDescription(range).c_str()); - } return shell_->AcceptsEditing(); } bool TestWebViewDelegate::shouldInsertNode(const WebNode& node, const WebRange& range, WebEditingAction action) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldInsertNode:%s " - "replacingDOMRange:%s givenAction:%s\n", - GetNodeDescription(node, 0).c_str(), - GetRangeDescription(range).c_str(), - GetEditingActionDescription(action).c_str()); - } return shell_->AcceptsEditing(); } bool TestWebViewDelegate::shouldInsertText(const WebString& text, const WebRange& range, WebEditingAction action) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldInsertText:%s " - "replacingDOMRange:%s givenAction:%s\n", - text.utf8().data(), - GetRangeDescription(range).c_str(), - GetEditingActionDescription(action).c_str()); - } return shell_->AcceptsEditing(); } @@ -436,32 +414,15 @@ bool TestWebViewDelegate::shouldChangeSelectedRange(const WebRange& from_range, const WebRange& to_range, WebTextAffinity affinity, bool still_selecting) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s " - "toDOMRange:%s affinity:%s stillSelecting:%s\n", - GetRangeDescription(from_range).c_str(), - GetRangeDescription(to_range).c_str(), - GetTextAffinityDescription(affinity).c_str(), - (still_selecting ? "TRUE" : "FALSE")); - } return shell_->AcceptsEditing(); } bool TestWebViewDelegate::shouldDeleteRange(const WebRange& range) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", - GetRangeDescription(range).c_str()); - } return shell_->AcceptsEditing(); } bool TestWebViewDelegate::shouldApplyStyle(const WebString& style, const WebRange& range) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", - style.utf8().data(), - GetRangeDescription(range).c_str()); - } return shell_->AcceptsEditing(); } @@ -474,32 +435,16 @@ bool TestWebViewDelegate::isSelectTrailingWhitespaceEnabled() { } void TestWebViewDelegate::didBeginEditing() { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: " - "webViewDidBeginEditing:WebViewDidBeginEditingNotification\n"); - } } void TestWebViewDelegate::didChangeSelection(bool is_empty_selection) { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: " - "webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n"); - } UpdateSelectionClipboard(is_empty_selection); } void TestWebViewDelegate::didChangeContents() { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: " - "webViewDidChange:WebViewDidChangeNotification\n"); - } } void TestWebViewDelegate::didEndEditing() { - if (shell_->ShouldDumpEditingCallbacks()) { - printf("EDITING DELEGATE: " - "webViewDidEndEditing:WebViewDidEndEditingNotification\n"); - } } bool TestWebViewDelegate::handleCurrentKeyboardEvent() { @@ -588,12 +533,6 @@ void TestWebViewDelegate::ClearContextMenuData() { void TestWebViewDelegate::setStatusText(const WebString& text) { - if (WebKit::layoutTestMode() && - shell_->layout_test_controller()->ShouldDumpStatusCallbacks()) { - // When running tests, write to stdout. - printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", - text.utf8().data()); - } } void TestWebViewDelegate::startDragging( @@ -821,18 +760,9 @@ void TestWebViewDelegate::unableToImplementPolicyWithError( void TestWebViewDelegate::willPerformClientRedirect( WebFrame* frame, const WebURL& from, const WebURL& to, double interval, double fire_time) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - willPerformClientRedirectToURL: %s \n", - GetFrameDescription(frame).c_str(), - to.spec().data()); - } } void TestWebViewDelegate::didCancelClientRedirect(WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didCancelClientRedirectForFrame\n", - GetFrameDescription(frame).c_str()); - } } void TestWebViewDelegate::didCreateDataSource( @@ -841,11 +771,6 @@ void TestWebViewDelegate::didCreateDataSource( } void TestWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didStartProvisionalLoadForFrame\n", - GetFrameDescription(frame).c_str()); - } - if (!top_loading_frame_) { top_loading_frame_ = frame; } @@ -860,20 +785,11 @@ void TestWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) { void TestWebViewDelegate::didReceiveServerRedirectForProvisionalLoad( WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didReceiveServerRedirectForProvisionalLoadForFrame\n", - GetFrameDescription(frame).c_str()); - } UpdateAddressBar(frame->view()); } void TestWebViewDelegate::didFailProvisionalLoad( WebFrame* frame, const WebURLError& error) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didFailProvisionalLoadWithError\n", - GetFrameDescription(frame).c_str()); - } - LocationChangeDone(frame); // Don't display an error page if we're running layout tests, because @@ -913,10 +829,6 @@ void TestWebViewDelegate::didFailProvisionalLoad( void TestWebViewDelegate::didCommitProvisionalLoad( WebFrame* frame, bool is_new_navigation) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didCommitLoadForFrame\n", - GetFrameDescription(frame).c_str()); - } UpdateForCommittedLoad(frame, is_new_navigation); } @@ -928,53 +840,27 @@ void TestWebViewDelegate::didReceiveTitle( WebFrame* frame, const WebString& title) { std::wstring wtitle = UTF16ToWideHack(title); - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didReceiveTitle: %S\n", - GetFrameDescription(frame).c_str(), wtitle.c_str()); - } - - if (shell_->ShouldDumpTitleChanges()) { - printf("TITLE CHANGED: %S\n", wtitle.c_str()); - } - SetPageTitle(wtitle); } void TestWebViewDelegate::didFinishDocumentLoad(WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didFinishDocumentLoadForFrame\n", - GetFrameDescription(frame).c_str()); - } else { - unsigned pending_unload_events = frame->unloadListenerCount(); - if (pending_unload_events) { - printf("%S - has %u onunload handler(s)\n", - GetFrameDescription(frame).c_str(), pending_unload_events); - } + unsigned pending_unload_events = frame->unloadListenerCount(); + if (pending_unload_events) { + printf("%S - has %u onunload handler(s)\n", + GetFrameDescription(frame).c_str(), pending_unload_events); } } void TestWebViewDelegate::didHandleOnloadEvents(WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didHandleOnloadEventsForFrame\n", - GetFrameDescription(frame).c_str()); - } } void TestWebViewDelegate::didFailLoad( WebFrame* frame, const WebURLError& error) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didFailLoadWithError\n", - GetFrameDescription(frame).c_str()); - } LocationChangeDone(frame); } void TestWebViewDelegate::didFinishLoad(WebFrame* frame) { TRACE_EVENT_END("frame.load", this, frame->url().spec()); - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didFinishLoadForFrame\n", - GetFrameDescription(frame).c_str()); - } UpdateAddressBar(frame->view()); LocationChangeDone(frame); } @@ -987,18 +873,10 @@ void TestWebViewDelegate::didNavigateWithinPage( } void TestWebViewDelegate::didChangeLocationWithinPage(WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) { - printf("%S - didChangeLocationWithinPageForFrame\n", - GetFrameDescription(frame).c_str()); - } } void TestWebViewDelegate::assignIdentifierToRequest( WebFrame* frame, unsigned identifier, const WebURLRequest& request) { - if (shell_->ShouldDumpResourceLoadCallbacks()) { - resource_identifier_map_[identifier] = - DescriptionSuitableForTestResult(request.url().spec()); - } } void TestWebViewDelegate::willSendRequest( @@ -1007,17 +885,6 @@ void TestWebViewDelegate::willSendRequest( GURL url = request.url(); std::string request_url = url.possibly_invalid_spec(); - if (shell_->ShouldDumpResourceLoadCallbacks()) { - GURL main_document_url = request.firstPartyForCookies(); - printf("%s - willSendRequest <NSURLRequest URL %s, main document URL %s," - " http method %s> redirectResponse %s\n", - GetResourceDescription(identifier).c_str(), - DescriptionSuitableForTestResult(request_url).c_str(), - GetURLDescription(main_document_url).c_str(), - request.httpMethod().utf8().data(), - GetResponseDescription(redirect_response).c_str()); - } - if (!redirect_response.isNull() && block_redirects_) { printf("Returning null for this redirect\n"); @@ -1058,46 +925,20 @@ void TestWebViewDelegate::willSendRequest( void TestWebViewDelegate::didReceiveResponse( WebFrame* frame, unsigned identifier, const WebURLResponse& response) { - if (shell_->ShouldDumpResourceLoadCallbacks()) { - printf("%s - didReceiveResponse %s\n", - GetResourceDescription(identifier).c_str(), - GetResponseDescription(response).c_str()); - } - if (shell_->ShouldDumpResourceResponseMIMETypes()) { - GURL url = response.url(); - WebString mimeType = response.mimeType(); - printf("%s has MIME type %s\n", - url.ExtractFileName().c_str(), - // Simulate NSURLResponse's mapping of empty/unknown MIME types to - // application/octet-stream. - mimeType.isEmpty() ? - "application/octet-stream" : mimeType.utf8().data()); - } } void TestWebViewDelegate::didFinishResourceLoad( WebFrame* frame, unsigned identifier) { TRACE_EVENT_END("url.load", identifier, ""); - if (shell_->ShouldDumpResourceLoadCallbacks()) { - printf("%s - didFinishLoading\n", - GetResourceDescription(identifier).c_str()); - } resource_identifier_map_.erase(identifier); } void TestWebViewDelegate::didFailResourceLoad( WebFrame* frame, unsigned identifier, const WebURLError& error) { - if (shell_->ShouldDumpResourceLoadCallbacks()) { - printf("%s - didFailLoadingWithError: %s\n", - GetResourceDescription(identifier).c_str(), - GetErrorDescription(error).c_str()); - } resource_identifier_map_.erase(identifier); } void TestWebViewDelegate::didDisplayInsecureContent(WebFrame* frame) { - if (shell_->ShouldDumpFrameLoadCallbacks()) - printf("didDisplayInsecureContent\n"); } // We have two didRunInsecureContent's with the same name. That's because @@ -1105,14 +946,10 @@ void TestWebViewDelegate::didDisplayInsecureContent(WebFrame* frame) { // Once the WebKit change is in, the first should be removed. void TestWebViewDelegate::didRunInsecureContent( WebFrame* frame, const WebSecurityOrigin& origin) { - if (shell_->ShouldDumpFrameLoadCallbacks()) - printf("didRunInsecureContent\n"); } void TestWebViewDelegate::didRunInsecureContent( WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) { - if (shell_->ShouldDumpFrameLoadCallbacks()) - printf("didRunInsecureContent\n"); } bool TestWebViewDelegate::allowScript(WebFrame* frame, |