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/feature_list.h" | 10 #include "base/feature_list.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/common/chrome_features.h" | 18 #include "chrome/common/chrome_features.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "chrome/test/base/test_switches.h" | 21 #include "chrome/test/base/test_switches.h" |
22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
23 #include "components/ui/zoom/zoom_controller.h" | 23 #include "components/zoom/zoom_controller.h" |
24 #include "content/public/browser/readback_types.h" | 24 #include "content/public/browser/readback_types.h" |
25 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
27 #include "content/public/browser/render_widget_host.h" | 27 #include "content/public/browser/render_widget_host.h" |
28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
29 #include "content/public/test/browser_test_utils.h" | 29 #include "content/public/test/browser_test_utils.h" |
30 #include "content/public/test/ppapi_test_utils.h" | 30 #include "content/public/test/ppapi_test_utils.h" |
31 #include "net/test/embedded_test_server/embedded_test_server.h" | 31 #include "net/test/embedded_test_server/embedded_test_server.h" |
32 #include "net/test/embedded_test_server/http_request.h" | 32 #include "net/test/embedded_test_server/http_request.h" |
33 #include "net/test/embedded_test_server/http_response.h" | 33 #include "net/test/embedded_test_server/http_response.h" |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 644 |
645 VerifyPluginMarkedEssential(background_contents, "same_origin"); | 645 VerifyPluginMarkedEssential(background_contents, "same_origin"); |
646 VerifyPluginIsThrottled(background_contents, "small_cross_origin"); | 646 VerifyPluginIsThrottled(background_contents, "small_cross_origin"); |
647 | 647 |
648 // TODO(groby): We need to cover the edge case of tiny plugin on a a | 648 // TODO(groby): We need to cover the edge case of tiny plugin on a a |
649 // background tab here. If blocking of tiny content is enabled | 649 // background tab here. If blocking of tiny content is enabled |
650 // this should be IsThrotthled, not IsPlaceholderOnly. | 650 // this should be IsThrotthled, not IsPlaceholderOnly. |
651 } | 651 } |
652 | 652 |
653 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { | 653 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { |
654 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents()) | 654 zoom::ZoomController::FromWebContents(GetActiveWebContents()) |
655 ->SetZoomLevel(4.0); | 655 ->SetZoomLevel(4.0); |
656 LoadHTML( | 656 LoadHTML( |
657 "<object id='plugin' data='http://otherorigin.com/fake.swf' " | 657 "<object id='plugin' data='http://otherorigin.com/fake.swf' " |
658 " type='application/x-ppapi-tests' width='400' height='200'>" | 658 " type='application/x-ppapi-tests' width='400' height='200'>" |
659 "</object>"); | 659 "</object>"); |
660 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 660 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
661 } | 661 } |
662 | 662 |
663 // Separate test case that blocks tiny plugins. This requires a separate test | 663 // Separate test case that blocks tiny plugins. This requires a separate test |
664 // case, because we need to initialize the renderer with a different feature | 664 // case, because we need to initialize the renderer with a different feature |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' " | 697 "<object id='tiny_cross_origin_2' data='http://a.com/fake.swf' " |
698 " type='application/x-ppapi-tests' width='1' height='1'>" | 698 " type='application/x-ppapi-tests' width='1' height='1'>" |
699 "</object>"); | 699 "</object>"); |
700 | 700 |
701 VerifyPluginMarkedEssential(GetActiveWebContents(), "large_same_origin"); | 701 VerifyPluginMarkedEssential(GetActiveWebContents(), "large_same_origin"); |
702 VerifyPluginMarkedEssential(GetActiveWebContents(), "small_same_origin"); | 702 VerifyPluginMarkedEssential(GetActiveWebContents(), "small_same_origin"); |
703 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_same_origin"); | 703 VerifyPluginMarkedEssential(GetActiveWebContents(), "tiny_same_origin"); |
704 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_1"); | 704 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_1"); |
705 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_2"); | 705 VerifyPluginIsPlaceholderOnly("tiny_cross_origin_2"); |
706 } | 706 } |
OLD | NEW |