OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
27 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
28 #include "content/public/test/ppapi_test_utils.h" | 28 #include "content/public/test/ppapi_test_utils.h" |
29 #include "net/test/embedded_test_server/embedded_test_server.h" | 29 #include "net/test/embedded_test_server/embedded_test_server.h" |
30 #include "net/test/embedded_test_server/http_request.h" | 30 #include "net/test/embedded_test_server/http_request.h" |
31 #include "net/test/embedded_test_server/http_response.h" | 31 #include "net/test/embedded_test_server/http_response.h" |
32 #include "ppapi/shared_impl/ppapi_switches.h" | 32 #include "ppapi/shared_impl/ppapi_switches.h" |
33 #include "third_party/WebKit/public/web/WebInputEvent.h" | 33 #include "third_party/WebKit/public/web/WebInputEvent.h" |
34 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
35 #include "ui/base/window_open_disposition.h" | 35 #include "ui/base/window_open_disposition.h" |
| 36 #include "ui/display/screen.h" |
36 #include "ui/gfx/codec/png_codec.h" | 37 #include "ui/gfx/codec/png_codec.h" |
37 #include "ui/gfx/geometry/point.h" | 38 #include "ui/gfx/geometry/point.h" |
38 #include "ui/gfx/screen.h" | |
39 #include "ui/gfx/switches.h" | 39 #include "ui/gfx/switches.h" |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 // Use fixed browser dimensions for pixel tests. | 43 // Use fixed browser dimensions for pixel tests. |
44 const int kBrowserWidth = 600; | 44 const int kBrowserWidth = 600; |
45 const int kBrowserHeight = 700; | 45 const int kBrowserHeight = 700; |
46 | 46 |
47 // Compare only a portion of the snapshots, as different platforms will | 47 // Compare only a portion of the snapshots, as different platforms will |
48 // capture different sized snapshots (due to differences in browser chrome). | 48 // capture different sized snapshots (due to differences in browser chrome). |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // The pixel tests run more reliably in software mode. | 284 // The pixel tests run more reliably in software mode. |
285 if (PixelTestsEnabled()) | 285 if (PixelTestsEnabled()) |
286 command_line->AppendSwitch(switches::kDisableGpu); | 286 command_line->AppendSwitch(switches::kDisableGpu); |
287 } | 287 } |
288 | 288 |
289 protected: | 289 protected: |
290 void LoadHTML(const std::string& html) { | 290 void LoadHTML(const std::string& html) { |
291 if (PixelTestsEnabled()) { | 291 if (PixelTestsEnabled()) { |
292 gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight)); | 292 gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight)); |
293 gfx::Rect screen_bounds = | 293 gfx::Rect screen_bounds = |
294 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 294 display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
295 ASSERT_GT(screen_bounds.width(), kBrowserWidth); | 295 ASSERT_GT(screen_bounds.width(), kBrowserWidth); |
296 ASSERT_GT(screen_bounds.height(), kBrowserHeight); | 296 ASSERT_GT(screen_bounds.height(), kBrowserHeight); |
297 browser()->window()->SetBounds(bounds); | 297 browser()->window()->SetBounds(bounds); |
298 } | 298 } |
299 | 299 |
300 ASSERT_TRUE(embedded_test_server()->Started()); | 300 ASSERT_TRUE(embedded_test_server()->Started()); |
301 embedded_test_server()->RegisterRequestHandler( | 301 embedded_test_server()->RegisterRequestHandler( |
302 base::Bind(&RespondWithHTML, html)); | 302 base::Bind(&RespondWithHTML, html)); |
303 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->base_url()); | 303 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->base_url()); |
304 EXPECT_TRUE(content::WaitForRenderFrameReady( | 304 EXPECT_TRUE(content::WaitForRenderFrameReady( |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 645 |
646 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { | 646 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { |
647 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents()) | 647 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents()) |
648 ->SetZoomLevel(4.0); | 648 ->SetZoomLevel(4.0); |
649 LoadHTML( | 649 LoadHTML( |
650 "<object id='plugin' data='http://otherorigin.com/fake.swf' " | 650 "<object id='plugin' data='http://otherorigin.com/fake.swf' " |
651 " type='application/x-ppapi-tests' width='400' height='200'>" | 651 " type='application/x-ppapi-tests' width='400' height='200'>" |
652 "</object>"); | 652 "</object>"); |
653 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 653 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
654 } | 654 } |
OLD | NEW |