| 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| 23 #include "chrome/test/base/test_switches.h" | 23 #include "chrome/test/base/test_switches.h" |
| 24 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.h" |
| 25 #include "components/content_settings/core/browser/host_content_settings_map.h" | 25 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 26 #include "components/zoom/zoom_controller.h" | 26 #include "components/zoom/zoom_controller.h" |
| 27 #include "content/public/browser/readback_types.h" | 27 #include "content/public/browser/readback_types.h" |
| 28 #include "content/public/browser/render_frame_host.h" | 28 #include "content/public/browser/render_frame_host.h" |
| 29 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
| 30 #include "content/public/browser/render_widget_host.h" | 30 #include "content/public/browser/render_widget_host.h" |
| 31 #include "content/public/browser/render_widget_host_view.h" |
| 31 #include "content/public/common/content_features.h" | 32 #include "content/public/common/content_features.h" |
| 32 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/test/browser_test_utils.h" | 34 #include "content/public/test/browser_test_utils.h" |
| 34 #include "content/public/test/ppapi_test_utils.h" | 35 #include "content/public/test/ppapi_test_utils.h" |
| 35 #include "net/test/embedded_test_server/embedded_test_server.h" | 36 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 36 #include "net/test/embedded_test_server/http_request.h" | 37 #include "net/test/embedded_test_server/http_request.h" |
| 37 #include "net/test/embedded_test_server/http_response.h" | 38 #include "net/test/embedded_test_server/http_response.h" |
| 38 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 39 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 39 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
| 40 #include "ui/base/window_open_disposition.h" | 41 #include "ui/base/window_open_disposition.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 base::FilePath(expected_filename)); | 360 base::FilePath(expected_filename)); |
| 360 | 361 |
| 361 GetActiveWebContents()->GetMainFrame()->InsertVisualStateCallback( | 362 GetActiveWebContents()->GetMainFrame()->InsertVisualStateCallback( |
| 362 base::Bind(&VerifyVisualStateUpdated, | 363 base::Bind(&VerifyVisualStateUpdated, |
| 363 base::MessageLoop::QuitWhenIdleClosure())); | 364 base::MessageLoop::QuitWhenIdleClosure())); |
| 364 content::RunMessageLoop(); | 365 content::RunMessageLoop(); |
| 365 | 366 |
| 366 content::RenderWidgetHost* rwh = | 367 content::RenderWidgetHost* rwh = |
| 367 GetActiveWebContents()->GetRenderViewHost()->GetWidget(); | 368 GetActiveWebContents()->GetRenderViewHost()->GetWidget(); |
| 368 | 369 |
| 369 if (!rwh->CanCopyFromBackingStore()) { | 370 if (!rwh->GetView() || !rwh->GetView()->IsSurfaceAvailableForCopy()) { |
| 370 ADD_FAILURE() << "Could not copy from backing store."; | 371 ADD_FAILURE() << "RWHV surface not available for copy."; |
| 371 return false; | 372 return false; |
| 372 } | 373 } |
| 373 | 374 |
| 374 bool snapshot_matches = false; | 375 bool snapshot_matches = false; |
| 375 rwh->CopyFromBackingStore( | 376 rwh->GetView()->CopyFromSurface( |
| 376 gfx::Rect(), gfx::Size(), | 377 gfx::Rect(), gfx::Size(), |
| 377 base::Bind(&CompareSnapshotToReference, reference, &snapshot_matches, | 378 base::Bind(&CompareSnapshotToReference, reference, &snapshot_matches, |
| 378 base::MessageLoop::QuitWhenIdleClosure()), | 379 base::MessageLoop::QuitWhenIdleClosure()), |
| 379 kN32_SkColorType); | 380 kN32_SkColorType); |
| 380 | 381 |
| 381 content::RunMessageLoop(); | 382 content::RunMessageLoop(); |
| 382 | 383 |
| 383 return snapshot_matches; | 384 return snapshot_matches; |
| 384 } | 385 } |
| 385 | 386 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, | 651 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, |
| 651 ThrottlePluginsOnAllowContentSetting) { | 652 ThrottlePluginsOnAllowContentSetting) { |
| 652 HostContentSettingsMap* content_settings_map = | 653 HostContentSettingsMap* content_settings_map = |
| 653 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); | 654 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); |
| 654 | 655 |
| 655 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 656 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| 656 CONTENT_SETTING_ALLOW); | 657 CONTENT_SETTING_ALLOW); |
| 657 LoadPeripheralPlugin(); | 658 LoadPeripheralPlugin(); |
| 658 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 659 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
| 659 } | 660 } |
| OLD | NEW |