Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / test / gpu / gpu_feature_browsertest.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "base/file_util.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/path_service.h"
9 #include "base/strings/stringprintf.h"
10 #include "base/test/trace_event_analyzer.h"
11 #include "base/version.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/tracing.h"
18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/gpu_data_manager.h"
20 #include "content/public/common/content_switches.h"
21 #include "content/public/test/browser_test_utils.h"
22 #include "gpu/config/gpu_feature_type.h"
23 #include "gpu/config/gpu_info.h"
24 #include "gpu/config/gpu_test_config.h"
25 #include "net/base/net_util.h"
26 #include "ui/gl/gl_implementation.h"
27
28 #if defined(OS_MACOSX)
29 #include "ui/gl/io_surface_support_mac.h"
30 #endif
31
32 #if defined(OS_WIN)
33 #include "base/win/windows_version.h"
34 #endif
35
36 using content::GpuDataManager;
37 using gpu::GpuFeatureType;
38 using trace_analyzer::Query;
39 using trace_analyzer::TraceAnalyzer;
40 using trace_analyzer::TraceEventVector;
41
42 namespace {
43
44 const char kSwapBuffersEvent[] = "SwapBuffers";
45 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation";
46 const char kWebGLCreationEvent[] = "DrawingBufferCreation";
47
48 class GpuFeatureTest : public InProcessBrowserTest {
49  public:
50   GpuFeatureTest() : category_patterns_("test_gpu") {}
51
52   virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
53     base::FilePath test_dir;
54     ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
55     gpu_test_dir_ = test_dir.AppendASCII("gpu");
56   }
57
58   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
59     command_line->AppendSwitch(switches::kDisablePopupBlocking);
60     command_line->AppendSwitchASCII(switches::kWindowSize, "400,300");
61   }
62
63   void SetupBlacklist(const std::string& json_blacklist) {
64     gpu::GPUInfo gpu_info;
65     GpuDataManager::GetInstance()->InitializeForTesting(
66         json_blacklist, gpu_info);
67   }
68
69   // If expected_reply is NULL, we don't check the reply content.
70   void RunTest(const base::FilePath& url,
71                const char* expected_reply,
72                bool new_tab) {
73 #if defined(OS_LINUX) && !defined(NDEBUG)
74     // Bypass tests on GPU Linux Debug bots.
75     if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL)
76       return;
77 #endif
78
79     base::FilePath test_path;
80     test_path = gpu_test_dir_.Append(url);
81     ASSERT_TRUE(base::PathExists(test_path))
82         << "Missing test file: " << test_path.value();
83
84     content::DOMMessageQueue message_queue;
85     if (new_tab) {
86       ui_test_utils::NavigateToURLWithDisposition(
87           browser(), net::FilePathToFileURL(test_path),
88           NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE);
89     } else {
90       ui_test_utils::NavigateToURL(
91           browser(), net::FilePathToFileURL(test_path));
92     }
93
94     std::string result;
95     // Wait for message indicating the test has finished running.
96     ASSERT_TRUE(message_queue.WaitForMessage(&result));
97     if (expected_reply)
98       EXPECT_STREQ(expected_reply, result.c_str());
99   }
100
101   // Open the URL and check the trace stream for the given event.
102   void RunEventTest(const base::FilePath& url,
103                     const char* event_name = NULL,
104                     bool event_expected = false) {
105 #if defined(OS_LINUX) && !defined(NDEBUG)
106     // Bypass tests on GPU Linux Debug bots.
107     if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL)
108       return;
109 #endif
110 #if defined(OS_MACOSX)
111     // Bypass tests on Mac OSX 10.5 bots (IOSurfaceSupport is now required).
112     if (!IOSurfaceSupport::Initialize())
113       return;
114 #endif
115
116     ASSERT_TRUE(tracing::BeginTracing(category_patterns_));
117
118     // Have to use a new tab for the blacklist to work.
119     RunTest(url, NULL, true);
120
121     ASSERT_TRUE(tracing::EndTracing(&trace_events_json_));
122
123     analyzer_.reset(TraceAnalyzer::Create(trace_events_json_));
124     analyzer_->AssociateBeginEndEvents();
125     TraceEventVector events;
126
127     if (!event_name)
128       return;
129
130     size_t event_count =
131         analyzer_->FindEvents(Query::EventNameIs(event_name), &events);
132
133     if (event_expected)
134       EXPECT_GT(event_count, 0U);
135     else
136       EXPECT_EQ(event_count, 0U);
137   }
138
139   // Trigger a resize of the chrome window, and use tracing to wait for the
140   // given |wait_event|.
141   bool ResizeAndWait(const gfx::Rect& new_bounds,
142                      const char* category_patterns,
143                      const char* wait_category,
144                      const char* wait_event) {
145     if (!tracing::BeginTracingWithWatch(category_patterns, wait_category,
146                                         wait_event, 1))
147       return false;
148     browser()->window()->SetBounds(new_bounds);
149     if (!tracing::WaitForWatchEvent(base::TimeDelta()))
150       return false;
151     if (!tracing::EndTracing(&trace_events_json_))
152       return false;
153     analyzer_.reset(TraceAnalyzer::Create(trace_events_json_));
154     analyzer_->AssociateBeginEndEvents();
155     return true;
156   }
157
158  protected:
159   base::FilePath gpu_test_dir_;
160   scoped_ptr<TraceAnalyzer> analyzer_;
161   std::string category_patterns_;
162   std::string trace_events_json_;
163 };
164
165 class GpuFeaturePixelTest : public GpuFeatureTest {
166  protected:
167   virtual void SetUp() OVERRIDE {
168     EnablePixelOutput();
169     GpuFeatureTest::SetUp();
170   }
171 };
172
173 #if defined(OS_WIN) || defined(ADDRESS_SANITIZER) || defined(USE_AURA) || \
174     defined(OS_MACOSX)
175 // This test is flaky on Windows. http://crbug.com/177113
176 // Also fails under AddressSanitizer. http://crbug.com/185178
177 // It fundamentally doesn't test the right thing on Aura.
178 // http://crbug.com/280675
179 // This does not work with software compositing on Mac. http://crbug.com/286038
180 #define MAYBE_AcceleratedCompositingAllowed DISABLED_AcceleratedCompositingAllowed
181 #else
182 #define MAYBE_AcceleratedCompositingAllowed AcceleratedCompositingAllowed
183 #endif
184
185 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_AcceleratedCompositingAllowed) {
186   EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted(
187       gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING));
188
189   const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
190   RunEventTest(url, kSwapBuffersEvent, true);
191 }
192
193 class AcceleratedCompositingBlockedTest : public GpuFeatureTest {
194  public:
195   virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
196     GpuFeatureTest::SetUpInProcessBrowserTestFixture();
197     const std::string json_blacklist =
198       "{\n"
199       "  \"name\": \"gpu blacklist\",\n"
200       "  \"version\": \"1.0\",\n"
201       "  \"entries\": [\n"
202       "    {\n"
203       "      \"id\": 1,\n"
204       "      \"features\": [\n"
205       "        \"accelerated_compositing\"\n"
206       "      ]\n"
207       "    }\n"
208       "  ]\n"
209       "}";
210     SetupBlacklist(json_blacklist);
211   }
212 };
213
214 #if defined(USE_AURA) || defined(OS_MACOSX)
215 // Compositing is always on for Aura and Mac.
216 #define MAYBE_AcceleratedCompositingBlocked DISABLED_AcceleratedCompositingBlocked
217 #else
218 #define MAYBE_AcceleratedCompositingBlocked AcceleratedCompositingBlocked
219 #endif
220
221 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingBlockedTest,
222                        MAYBE_AcceleratedCompositingBlocked) {
223   EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted(
224       gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING));
225
226   const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
227   RunEventTest(url, kSwapBuffersEvent, false);
228 }
229
230 class AcceleratedCompositingTest : public GpuFeatureTest {
231  public:
232   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
233     GpuFeatureTest::SetUpCommandLine(command_line);
234     command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
235   }
236 };
237
238 #if defined(USE_AURA) || defined(OS_MACOSX)
239 // Compositing is always on for Aura and Mac.
240 #define MAYBE_AcceleratedCompositingDisabled DISABLED_AcceleratedCompositingDisabled
241 #else
242 #define MAYBE_AcceleratedCompositingDisabled AcceleratedCompositingDisabled
243 #endif
244
245 IN_PROC_BROWSER_TEST_F(AcceleratedCompositingTest,
246                        MAYBE_AcceleratedCompositingDisabled) {
247 // Compositing is always on for Windows Aura.
248   const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
249   RunEventTest(url, kSwapBuffersEvent, false);
250 }
251
252 // Times out: http://crbug.com/166060
253 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, DISABLED_WebGLAllowed) {
254   EXPECT_FALSE(GpuDataManager::GetInstance()->IsFeatureBlacklisted(
255       gpu::GPU_FEATURE_TYPE_WEBGL));
256
257   const base::FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
258   RunEventTest(url, kWebGLCreationEvent, true);
259 }
260
261 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, WebGLBlocked) {
262   const std::string json_blacklist =
263       "{\n"
264       "  \"name\": \"gpu blacklist\",\n"
265       "  \"version\": \"1.0\",\n"
266       "  \"entries\": [\n"
267       "    {\n"
268       "      \"id\": 1,\n"
269       "      \"features\": [\n"
270       "        \"webgl\"\n"
271       "      ]\n"
272       "    }\n"
273       "  ]\n"
274       "}";
275   SetupBlacklist(json_blacklist);
276   EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted(
277       gpu::GPU_FEATURE_TYPE_WEBGL));
278
279   const base::FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
280   RunEventTest(url, kWebGLCreationEvent, false);
281 }
282
283 class WebGLTest : public GpuFeatureTest {
284  public:
285   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
286     GpuFeatureTest::SetUpCommandLine(command_line);
287 #if !defined(OS_ANDROID)
288     // On Android, WebGL is disabled by default
289     command_line->AppendSwitch(switches::kDisableExperimentalWebGL);
290 #endif
291   }
292 };
293
294 IN_PROC_BROWSER_TEST_F(WebGLTest, WebGLDisabled) {
295   const base::FilePath url(FILE_PATH_LITERAL("feature_webgl.html"));
296   RunEventTest(url, kWebGLCreationEvent, false);
297 }
298
299 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX)
300 // This test is oblivious to the fact that multisample could be blacklisted on
301 // some configurations.
302 // http://crbug.com/314745
303 #define MAYBE_MultisamplingAllowed DISABLED_MultisamplingAllowed
304 #else
305 #define MAYBE_MultisamplingAllowed MultisamplingAllowed
306 #endif
307 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_MultisamplingAllowed) {
308   if (gpu::GPUTestBotConfig::GpuBlacklistedOnBot())
309     return;
310   // Multisampling is not supported if running on top of osmesa.
311   if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL)
312     return;
313   // Linux Intel uses mesa driver, where multisampling is not supported.
314   // Multisampling is also not supported on virtualized mac os.
315   std::vector<std::string> configs;
316   configs.push_back("LINUX INTEL");
317   configs.push_back("MAC VMWARE");
318   if (gpu::GPUTestBotConfig::CurrentConfigMatches(configs))
319     return;
320
321   const base::FilePath url(FILE_PATH_LITERAL("feature_multisampling.html"));
322   RunTest(url, "\"TRUE\"", true);
323 }
324
325 class WebGLMultisamplingTest : public GpuFeatureTest {
326  public:
327   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
328     GpuFeatureTest::SetUpCommandLine(command_line);
329     command_line->AppendSwitch(switches::kDisableGLMultisampling);
330   }
331 };
332
333 IN_PROC_BROWSER_TEST_F(WebGLMultisamplingTest, MultisamplingDisabled) {
334   // Multisampling fails on virtualized mac os.
335   if (gpu::GPUTestBotConfig::CurrentConfigMatches("MAC VMWARE"))
336     return;
337
338   const base::FilePath url(FILE_PATH_LITERAL("feature_multisampling.html"));
339   RunTest(url, "\"FALSE\"", true);
340 }
341
342 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DAllowed) {
343   // Accelerated canvas 2D is not supported on XP.
344   if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP"))
345     return;
346
347   enum Canvas2DState {
348     ENABLED,
349     BLACKLISTED,  // Disabled via the blacklist.
350     DISABLED,     // Not disabled via the blacklist, but expected to be disabled
351                   // by configuration.
352   } expected_state = ENABLED;
353 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
354   // Blacklist rule #24 disables accelerated_2d_canvas on Linux.
355   expected_state = BLACKLISTED;
356 #elif defined(OS_WIN)
357   // Blacklist rule #67 disables accelerated_2d_canvas on XP.
358   if (base::win::GetVersion() < base::win::VERSION_VISTA)
359     expected_state = BLACKLISTED;
360 #endif
361
362   if (gpu::GPUTestBotConfig::GpuBlacklistedOnBot())
363     expected_state = BLACKLISTED;
364
365 #if defined(USE_AURA)
366   // Canvas 2D is always disabled in software compositing mode, make sure it is
367   // marked as such if it wasn't blacklisted already.
368   if (expected_state == ENABLED &&
369       !content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) {
370     expected_state = DISABLED;
371   }
372 #endif
373
374   EXPECT_EQ(expected_state == BLACKLISTED,
375             GpuDataManager::GetInstance()->IsFeatureBlacklisted(
376                 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS));
377
378   const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
379   RunEventTest(url, kAcceleratedCanvasCreationEvent, expected_state == ENABLED);
380 }
381
382 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, Canvas2DBlocked) {
383   const std::string json_blacklist =
384       "{\n"
385       "  \"name\": \"gpu blacklist\",\n"
386       "  \"version\": \"1.0\",\n"
387       "  \"entries\": [\n"
388       "    {\n"
389       "      \"id\": 1,\n"
390       "      \"features\": [\n"
391       "        \"accelerated_2d_canvas\"\n"
392       "      ]\n"
393       "    }\n"
394       "  ]\n"
395       "}";
396   SetupBlacklist(json_blacklist);
397   EXPECT_TRUE(GpuDataManager::GetInstance()->IsFeatureBlacklisted(
398       gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS));
399
400   const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
401   RunEventTest(url, kAcceleratedCanvasCreationEvent, false);
402 }
403
404 class Canvas2DDisabledTest : public GpuFeatureTest {
405  public:
406   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
407     GpuFeatureTest::SetUpCommandLine(command_line);
408     command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
409   }
410 };
411
412 IN_PROC_BROWSER_TEST_F(Canvas2DDisabledTest, Canvas2DDisabled) {
413   const base::FilePath url(FILE_PATH_LITERAL("feature_canvas2d.html"));
414   RunEventTest(url, kAcceleratedCanvasCreationEvent, false);
415 }
416
417 IN_PROC_BROWSER_TEST_F(GpuFeaturePixelTest,
418                        CanOpenPopupAndRenderWithWebGLCanvas) {
419   if (gpu::GPUTestBotConfig::GpuBlacklistedOnBot())
420     return;
421
422   const base::FilePath url(FILE_PATH_LITERAL("webgl_popup.html"));
423   RunTest(url, "\"SUCCESS\"", false);
424 }
425
426 // crbug.com/176466
427 IN_PROC_BROWSER_TEST_F(GpuFeatureTest,
428                        DISABLED_CanOpenPopupAndRenderWith2DCanvas) {
429   const base::FilePath url(FILE_PATH_LITERAL("canvas_popup.html"));
430   RunTest(url, "\"SUCCESS\"", false);
431 }
432
433 class ThreadedCompositorTest : public GpuFeatureTest {
434  public:
435   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
436     GpuFeatureTest::SetUpCommandLine(command_line);
437     command_line->AppendSwitch(switches::kEnableThreadedCompositing);
438   }
439 };
440
441 // http://crbug.com/157985
442 IN_PROC_BROWSER_TEST_F(ThreadedCompositorTest, DISABLED_ThreadedCompositor) {
443   const base::FilePath url(FILE_PATH_LITERAL("feature_compositing.html"));
444   RunEventTest(url, kSwapBuffersEvent, true);
445 }
446
447
448 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
449 // http://crbug.com/162343: flaky on Windows and Mac, failing on ChromiumOS.
450 #define MAYBE_RafNoDamage DISABLED_RafNoDamage
451 #else
452 #define MAYBE_RafNoDamage RafNoDamage
453 #endif
454 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_RafNoDamage) {
455   category_patterns_ = "-test_*";
456   const base::FilePath url(FILE_PATH_LITERAL("feature_raf_no_damage.html"));
457   RunEventTest(url);
458
459   if (!analyzer_.get())
460     return;
461
462   // Search for matching name on begin event or async_begin event (any begin).
463   Query query_raf =
464       (Query::EventPhaseIs(TRACE_EVENT_PHASE_BEGIN) ||
465        Query::EventPhaseIs(TRACE_EVENT_PHASE_ASYNC_BEGIN)) &&
466       Query::EventNameIs("___RafWithNoDamage___");
467   TraceEventVector events;
468   size_t num_events = analyzer_->FindEvents(query_raf, &events);
469
470   trace_analyzer::RateStats stats;
471   trace_analyzer::RateStatsOptions stats_options;
472   stats_options.trim_min = stats_options.trim_max = num_events / 10;
473   EXPECT_TRUE(trace_analyzer::GetRateStats(events, &stats, &stats_options));
474
475   LOG(INFO) << "Number of RAFs: " << num_events <<
476       " Mean: " << stats.mean_us <<
477       " Min: " << stats.min_us <<
478       " Max: " << stats.max_us <<
479       " StdDev: " << stats.standard_deviation_us;
480
481   // Expect that the average time between RAFs is more than 15ms. That will
482   // indicate that the renderer is not simply spinning on RAF.
483   EXPECT_GT(stats.mean_us, 15000.0);
484
485   // Print out the trace events upon error to debug failures.
486   if (stats.mean_us <= 15000.0) {
487     fprintf(stderr, "\n\nTRACE JSON:\n\n%s\n\n", trace_events_json_.c_str());
488   }
489 }
490
491 #if defined(OS_MACOSX)
492 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, IOSurfaceReuse) {
493   if (!IOSurfaceSupport::Initialize())
494     return;
495
496   if (gpu::GPUTestBotConfig::GpuBlacklistedOnBot())
497     return;
498
499   const base::FilePath url(
500       FILE_PATH_LITERAL("feature_compositing_static.html"));
501   base::FilePath test_path = gpu_test_dir_.Append(url);
502   ASSERT_TRUE(base::PathExists(test_path))
503       << "Missing test file: " << test_path.value();
504
505   ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path));
506
507   LOG(INFO) << "did navigate";
508   gfx::Rect bounds = browser()->window()->GetBounds();
509   gfx::Rect new_bounds = bounds;
510
511   const char* create_event = "IOSurfaceImageTransportSurface::CreateIOSurface";
512   const char* resize_event = "IOSurfaceImageTransportSurface::OnResize";
513   const char* draw_event = "CompositingIOSurfaceMac::DrawIOSurface";
514   Query find_creates = Query::MatchBeginName(create_event);
515   Query find_resizes = Query::MatchBeginName(resize_event) &&
516                        Query::EventHasNumberArg("old_width") &&
517                        Query::EventHasNumberArg("new_width");
518   Query find_draws = Query::MatchBeginName(draw_event) &&
519                      Query::EventHasNumberArg("scale");
520
521   const int roundup = 64;
522   // A few resize values assuming a roundup of 64 pixels. The test will resize
523   // by these values one at a time and verify that CreateIOSurface only happens
524   // when the rounded width changes.
525   int offsets[] = { 1, roundup - 1, roundup, roundup + 1, 2*roundup};
526   int num_offsets = static_cast<int>(arraysize(offsets));
527   int w_start = bounds.width();
528
529   for (int offset_i = 0; offset_i < num_offsets; ++offset_i) {
530     new_bounds.set_width(w_start + offsets[offset_i]);
531     LOG(INFO) << "before wait";
532     ASSERT_TRUE(ResizeAndWait(new_bounds, "gpu", "gpu", resize_event));
533     LOG(INFO) << "after wait";
534
535     TraceEventVector resize_events;
536     analyzer_->FindEvents(find_resizes, &resize_events);
537     LOG(INFO) << "num rezize events = " << resize_events.size();
538     for (size_t resize_i = 0; resize_i < resize_events.size(); ++resize_i) {
539       const trace_analyzer::TraceEvent* resize = resize_events[resize_i];
540       // Was a create allowed:
541       int old_width = resize->GetKnownArgAsInt("old_width");
542       int new_width = resize->GetKnownArgAsInt("new_width");
543       bool expect_create = (old_width/roundup != new_width/roundup ||
544                             old_width == 0);
545       int expected_creates = expect_create ? 1 : 0;
546
547       // Find the create event inside this resize event (if any). This will
548       // determine if the resize triggered a reallocation of the IOSurface.
549       double begin_time = resize->timestamp;
550       double end_time = begin_time + resize->GetAbsTimeToOtherEvent();
551       Query find_this_create = find_creates &&
552           Query::EventTime() >= Query::Double(begin_time) &&
553           Query::EventTime() <= Query::Double(end_time);
554       TraceEventVector create_events;
555       int num_creates = static_cast<int>(analyzer_->FindEvents(find_this_create,
556                                                                &create_events));
557       EXPECT_EQ(expected_creates, num_creates);
558
559       // For debugging failures, print out the width and height of each resize:
560       LOG(INFO) <<
561           base::StringPrintf(
562               "%d (resize offset %d): IOSurface width %d -> %d; Creates %d "
563               "Expected %d", offset_i, offsets[offset_i],
564               old_width, new_width, num_creates, expected_creates);
565     }
566   }
567   LOG(INFO) << "finished test";
568 }
569 #endif
570
571 }  // namespace