| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 14 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
| 17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "chrome/test/base/test_launcher_utils.h" | 18 #include "chrome/test/base/test_launcher_utils.h" |
| 19 #include "chrome/test/base/tracing.h" | 19 #include "chrome/test/base/tracing.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 21 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/test/browser_test_utils.h" |
| 24 #include "content/test/gpu/test_switches.h" | 25 #include "content/test/gpu/test_switches.h" |
| 25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 26 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 28 #include "third_party/skia/include/core/SkBitmap.h" | 29 #include "third_party/skia/include/core/SkBitmap.h" |
| 29 #include "third_party/skia/include/core/SkColor.h" | 30 #include "third_party/skia/include/core/SkColor.h" |
| 30 #include "ui/compositor/compositor_setup.h" | 31 #include "ui/compositor/compositor_setup.h" |
| 31 #include "ui/gfx/codec/png_codec.h" | 32 #include "ui/gfx/codec/png_codec.h" |
| 32 #include "ui/gfx/size.h" | 33 #include "ui/gfx/size.h" |
| 33 #include "ui/gl/gl_switches.h" | 34 #include "ui/gl/gl_switches.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 ASSERT_TRUE(message_queue.WaitForMessage(NULL)); | 156 ASSERT_TRUE(message_queue.WaitForMessage(NULL)); |
| 156 message_queue.ClearQueue(); | 157 message_queue.ClearQueue(); |
| 157 | 158 |
| 158 gfx::Rect new_bounds = GetNewTabContainerBounds(tab_container_size); | 159 gfx::Rect new_bounds = GetNewTabContainerBounds(tab_container_size); |
| 159 | 160 |
| 160 std::wostringstream js_call; | 161 std::wostringstream js_call; |
| 161 js_call << "preCallResizeInChromium("; | 162 js_call << "preCallResizeInChromium("; |
| 162 js_call << new_bounds.width() << ", " << new_bounds.height(); | 163 js_call << new_bounds.width() << ", " << new_bounds.height(); |
| 163 js_call << ");"; | 164 js_call << ");"; |
| 164 | 165 |
| 165 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 166 ASSERT_TRUE(content::ExecuteJavaScript( |
| 166 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 167 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
| 167 L"", js_call.str())); | 168 L"", js_call.str())); |
| 168 | 169 |
| 169 std::string message; | 170 std::string message; |
| 170 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 171 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 171 message_queue.ClearQueue(); | 172 message_queue.ClearQueue(); |
| 172 browser()->window()->SetBounds(new_bounds); | 173 browser()->window()->SetBounds(new_bounds); |
| 173 | 174 |
| 174 // Wait for message from test page indicating the rendering is done. | 175 // Wait for message from test page indicating the rendering is done. |
| 175 while (message.compare("\"resized\"")) { | 176 while (message.compare("\"resized\"")) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 IN_PROC_BROWSER_TEST_F(Canvas2DPixelTestSD, Canvas2DRedBoxSD) { | 507 IN_PROC_BROWSER_TEST_F(Canvas2DPixelTestSD, Canvas2DRedBoxSD) { |
| 507 // If test baseline needs to be updated after a given revision, update the | 508 // If test baseline needs to be updated after a given revision, update the |
| 508 // following number. If no revision requirement, then 0. | 509 // following number. If no revision requirement, then 0. |
| 509 const int64 ref_img_revision_update = 123489; | 510 const int64 ref_img_revision_update = 123489; |
| 510 | 511 |
| 511 gfx::Size container_size(400, 300); | 512 gfx::Size container_size(400, 300); |
| 512 FilePath url = | 513 FilePath url = |
| 513 test_data_dir().AppendASCII("pixel_canvas2d.html"); | 514 test_data_dir().AppendASCII("pixel_canvas2d.html"); |
| 514 RunPixelTest(container_size, url, ref_img_revision_update); | 515 RunPixelTest(container_size, url, ref_img_revision_update); |
| 515 } | 516 } |
| OLD | NEW |