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

Unified Diff: chrome/test/gpu/gpu_pixel_browsertest.cc

Issue 9663033: Debug flaky gpu pixel tests by printing event trace on failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: zmo feedback Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/gpu/pixel_canvas2d.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/gpu/gpu_pixel_browsertest.cc
diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc
index d9cbb486c55613e51d0e7eb355b79fea4bbaf0df..3b371c1671913b3652a388e0502c554930319be1 100644
--- a/chrome/test/gpu/gpu_pixel_browsertest.cc
+++ b/chrome/test/gpu/gpu_pixel_browsertest.cc
@@ -15,6 +15,7 @@
#include "chrome/common/chrome_version_info.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/test_launcher_utils.h"
+#include "chrome/test/base/tracing.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -116,6 +117,10 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
ref_img_revision_no_older_than_ = ref_img_update_revision;
ObtainLocalRefImageFilePath();
+#if defined(OS_WIN)
+ ASSERT_TRUE(tracing::BeginTracing("-test_*"));
+#endif
+
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ui_test_utils::DOMMessageQueue message_queue;
@@ -148,7 +153,17 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
SkBitmap bitmap;
ASSERT_TRUE(TabSnapShotToImage(&bitmap));
- ASSERT_TRUE(CompareImages(bitmap, ignore_bottom_corners));
+ bool is_image_same = CompareImages(bitmap, ignore_bottom_corners);
+ EXPECT_TRUE(is_image_same);
+
+#if defined(OS_WIN)
+ // For debugging the flaky test, this prints out a trace of what happened on
+ // failure.
+ std::string trace_events;
+ ASSERT_TRUE(tracing::EndTracing(&trace_events));
+ if (!is_image_same)
+ fprintf(stderr, "\n\nTRACE JSON:\n\n%s\n\n", trace_events.c_str());
+#endif
}
const FilePath& test_data_dir() const {
« no previous file with comments | « chrome/test/data/gpu/pixel_canvas2d.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698