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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 EXPECT_FALSE(IsPluginPeripheral("plugin")); | 72 EXPECT_FALSE(IsPluginPeripheral("plugin")); |
73 } | 73 } |
74 | 74 |
75 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOrigin) { | 75 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOrigin) { |
76 LoadHTML( | 76 LoadHTML( |
77 "<object id='plugin' data='http://otherorigin.com/fake.swf' " | 77 "<object id='plugin' data='http://otherorigin.com/fake.swf' " |
78 "type='application/x-ppapi-tests' width='400' height='500'></object>"); | 78 "type='application/x-ppapi-tests' width='400' height='500'></object>"); |
79 EXPECT_FALSE(IsPluginPeripheral("plugin")); | 79 EXPECT_FALSE(IsPluginPeripheral("plugin")); |
80 } | 80 } |
81 | 81 |
82 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeWithPoster) { | 82 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargePluginsUsePosters) { |
Lei Zhang
2015/04/15 07:39:07
Just name this correctly in the CL that adds it.
tommycli
2015/04/17 00:12:15
Done.
| |
83 LoadHTML( | 83 LoadHTML( |
84 "<object id='plugin' type='application/x-ppapi-tests' " | 84 "<object id='plugin' type='application/x-ppapi-tests' " |
85 " width='400' height='500'>" | 85 " width='400' height='500'>" |
86 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x' />" | 86 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x' />" |
87 "</object>"); | 87 "</object>"); |
88 EXPECT_TRUE(IsPluginPeripheral("plugin")); | 88 EXPECT_TRUE(IsPluginPeripheral("plugin")); |
89 } | 89 } |
90 | 90 |
91 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, SmallPluginWithPoster) { | |
92 LoadHTML( | |
93 "<object id='plugin' type='application/x-ppapi-tests' " | |
94 " width='400' height='100'>" | |
95 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x' />" | |
96 "</object>"); | |
97 EXPECT_TRUE(IsPluginPeripheral("plugin")); | |
98 | |
99 // Test that the small plugin is essential after clicking on poster. | |
100 content::SimulateMouseClickAt(GetActiveWebContents(), 0 /* modifiers */, | |
101 blink::WebMouseEvent::ButtonLeft, | |
102 gfx::Point(50, 50)); | |
103 content::RunAllBlockingPoolTasksUntilIdle(); | |
104 | |
105 EXPECT_FALSE(IsPluginPeripheral("plugin")); | |
106 } | |
107 | |
91 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, OriginWhitelisting) { | 108 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, OriginWhitelisting) { |
92 LoadHTML( | 109 LoadHTML( |
93 "<object id='plugin1' data='http://otherorigin.com/fake1.swf' " | 110 "<object id='plugin1' data='http://otherorigin.com/fake1.swf' " |
94 "type='application/x-ppapi-tests' width='400' height='100'></object>" | 111 "type='application/x-ppapi-tests' width='400' height='100'></object>" |
95 "<object id='plugin2' data='http://otherorigin.com/fake2.swf' " | 112 "<object id='plugin2' data='http://otherorigin.com/fake2.swf' " |
96 "type='application/x-ppapi-tests' width='400' height='500'></object>"); | 113 "type='application/x-ppapi-tests' width='400' height='500'></object>"); |
97 EXPECT_FALSE(IsPluginPeripheral("plugin1")); | 114 EXPECT_FALSE(IsPluginPeripheral("plugin1")); |
98 EXPECT_FALSE(IsPluginPeripheral("plugin2")); | 115 EXPECT_FALSE(IsPluginPeripheral("plugin2")); |
99 } | 116 } |
100 | 117 |
101 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOriginObscured) { | 118 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOriginObscured) { |
102 LoadHTML( | 119 LoadHTML( |
103 "<div style='width: 100px; height: 100px; overflow: hidden;'>" | 120 "<div style='width: 100px; height: 100px; overflow: hidden;'>" |
104 " <object id='plugin' data='http://otherorigin.com/fake.swf' " | 121 " <object id='plugin' data='http://otherorigin.com/fake.swf' " |
105 " type='application/x-ppapi-tests' width='400' height='500'></object>" | 122 " type='application/x-ppapi-tests' width='400' height='500'></object>" |
106 "</div>"); | 123 "</div>"); |
107 EXPECT_TRUE(IsPluginPeripheral("plugin")); | 124 EXPECT_TRUE(IsPluginPeripheral("plugin")); |
108 } | 125 } |
OLD | NEW |