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..2c8e2ebe1fc07dd36253b106cc262a1b337426c9 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 |
+#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); |
+ ASSERT_TRUE(!screenshot_size.IsEmpty()); |
+ ASSERT_TRUE(!screenshot_png.empty()); |
+ |
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); |
+ |
+ ASSERT_TRUE(success); |
ASSERT_TRUE(CompareImages(bitmap, "")); |
} |