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

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

Issue 9706039: Fixes the timeout issue with the pixel tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_webgl.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 50e92b69200bb8d44759868264785100b433d617..807f13eaaa7f17aa03143f549debcdd461cb3ec0 100644
--- a/chrome/test/gpu/gpu_pixel_browsertest.cc
+++ b/chrome/test/gpu/gpu_pixel_browsertest.cc
@@ -145,16 +145,23 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
ASSERT_TRUE(message_queue.WaitForMessage(NULL));
message_queue.ClearQueue();
+ gfx::Rect new_bounds = GetNewTabContainerBounds(tab_container_size);
+
+ std::wostringstream js_call;
+ js_call << "preCallResizeInChromium(";
+ js_call << new_bounds.width() << ", " << new_bounds.height();
+ js_call << ");";
+
ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(
browser()->GetSelectedWebContents()->GetRenderViewHost(),
- L"", L"preCallResizeInChromium();"));
+ L"", js_call.str()));
- ASSERT_TRUE(message_queue.WaitForMessage(NULL));
+ std::string message;
+ ASSERT_TRUE(message_queue.WaitForMessage(&message));
message_queue.ClearQueue();
- ResizeTabContainer(tab_container_size);
+ browser()->window()->SetBounds(new_bounds);
// Wait for message from test page indicating the rendering is done.
- std::string message;
while (message.compare("\"resized\"")) {
ASSERT_TRUE(message_queue.WaitForMessage(&message));
message_queue.ClearQueue();
@@ -330,8 +337,9 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
return rt;
}
- // Resizes the browser window so that the tab's contents are at a given size.
- void ResizeTabContainer(const gfx::Size& desired_size) {
+ // Returns a gfx::Rect representing the bounds that the browser window should
+ // have if the tab contents have the desired size.
+ gfx::Rect GetNewTabContainerBounds(const gfx::Size& desired_size) {
gfx::Rect container_rect;
browser()->GetSelectedWebContents()->GetContainerBounds(&container_rect);
// Size cannot be negative, so use a point.
@@ -343,7 +351,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
gfx::Size new_size = window_rect.size();
new_size.Enlarge(correction.x(), correction.y());
window_rect.set_size(new_size);
- browser()->window()->SetBounds(window_rect);
+ return window_rect;
}
// Take snapshot of the current tab, encode it as PNG, and save to a SkBitmap.
« no previous file with comments | « chrome/test/data/gpu/pixel_webgl.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698