Chromium Code Reviews| Index: chrome/browser/gpu_pixel_browsertest.cc |
| diff --git a/chrome/browser/gpu_pixel_browsertest.cc b/chrome/browser/gpu_pixel_browsertest.cc |
| index 26581fa41a86711a678e77d94070281286ba8050..78f52ed5d0d460fbf24438bd383f7e2a44c0f012 100644 |
| --- a/chrome/browser/gpu_pixel_browsertest.cc |
| +++ b/chrome/browser/gpu_pixel_browsertest.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/stringprintf.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_window.h" |
| +#include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| @@ -255,25 +256,49 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { |
| DISALLOW_COPY_AND_ASSIGN(GpuPixelBrowserTest); |
| }; |
| -// Currently fails (and times out) on linux due to a NOTIMPLEMENTED() statement. |
| -// (http://crbug.com/89964) |
| -// Fails (and times out) on Windows/Mac due to pixel mismatch. |
| -// (http://crbug.com/95214) |
| -IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, DISABLED_WebGLTeapot) { |
| +#if defined(USE_AURA) |
| +#define MAYBE_WEBGLTeapot DISABLED_WebGLTeapot |
|
jonathan.backer
2011/11/11 14:41:20
nit: case is wrong s/WEB/Web
|
| +#else |
| +#define MAYBE_WebGLTeapot WebGLTeapot |
| +#endif |
| + |
| +IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MAYBE_WebGLTeapot) { |
| ui_test_utils::DOMMessageQueue message_queue; |
| ui_test_utils::NavigateToURL( |
| browser(), |
| net::FilePathToFileURL(test_data_dir_.AppendASCII("webgl_teapot"). |
| AppendASCII("teapot.html"))); |
| + gfx::Size container_size(500, 500); |
| + ResizeTabContainer(browser(), container_size); |
| + |
| // Wait for message from teapot page indicating the GL calls have been issued. |
| ASSERT_TRUE(message_queue.WaitForMessage(NULL)); |
| + std::vector<unsigned char> screenshot_png; |
| + |
| + gfx::Rect root_bounds = browser()->window()->GetBounds(); |
| + gfx::Rect tab_contents_bounds; |
| + browser()->GetSelectedTabContents()->GetContainerBounds(&tab_contents_bounds); |
| + |
| + gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), |
| + tab_contents_bounds.y() - root_bounds.y(), |
| + tab_contents_bounds.width(), |
| + tab_contents_bounds.height()); |
| + |
| + gfx::NativeWindow native_window = browser()->window()->GetNativeHandle(); |
| + gfx::Rect screenshot_size = browser::GrabWindowSnapshot(native_window, |
| + &screenshot_png, |
| + snapshot_bounds); |
| + DCHECK(!screenshot_size.IsEmpty()); |
|
jonathan.backer
2011/11/11 14:41:20
ASSERT_TRUE
|
| + DCHECK(!screenshot_png.empty()); |
|
kkania
2011/11/11 17:06:31
ASSERT_TRUE here too. It's generally better to fai
|
| + |
| SkBitmap bitmap; |
| - gfx::Size container_size(500, 500); |
| - ResizeTabContainer(browser(), container_size); |
| - ASSERT_TRUE(ui_test_utils::TakeRenderWidgetSnapshot( |
| - browser()->GetSelectedTabContents()->render_view_host(), |
| - container_size, &bitmap)); |
| + bool success = gfx::PNGCodec::Decode( |
| + reinterpret_cast<unsigned char*>(&*screenshot_png.begin()), |
| + screenshot_png.size(), |
| + &bitmap); |
| + |
| + DCHECK(success); |
|
kkania
2011/11/11 17:06:31
ASSERT_TRUE
|
| ASSERT_TRUE(CompareImages(bitmap, "")); |
| } |