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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 SimulateClickAndAwaitMarkedEssential("plugin", gfx::Point(50, 50)); | 120 SimulateClickAndAwaitMarkedEssential("plugin", gfx::Point(50, 50)); |
121 } | 121 } |
122 | 122 |
123 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOrigin) { | 123 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOrigin) { |
124 LoadHTML( | 124 LoadHTML( |
125 "<object id='plugin' data='http://otherorigin.com/fake.swf' " | 125 "<object id='plugin' data='http://otherorigin.com/fake.swf' " |
126 "type='application/x-ppapi-tests' width='400' height='500'></object>"); | 126 "type='application/x-ppapi-tests' width='400' height='500'></object>"); |
127 EXPECT_FALSE(IsPluginPeripheral("plugin")); | 127 EXPECT_FALSE(IsPluginPeripheral("plugin")); |
128 } | 128 } |
129 | 129 |
130 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargePluginsUsePosters) { | 130 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, |
| 131 LargePluginsPeripheralWhenPosterSpecified) { |
| 132 LoadHTML( |
| 133 "<object id='plugin_src' type='application/x-ppapi-tests' " |
| 134 " width='400' height='500'" |
| 135 " poster='snapshot1x.png' />" |
| 136 "<object id='plugin_srcset' type='application/x-ppapi-tests' " |
| 137 " width='400' height='500'" |
| 138 " poster='snapshot1x.png 1x, snapshot2x.png 2x' />" |
| 139 "<object id='plugin_legacy_syntax' type='application/x-ppapi-tests' " |
| 140 " width='400' height='500'>" |
| 141 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x' />" |
| 142 "</object>" |
| 143 "<embed id='plugin_embed_src' type='application/x-ppapi-tests' " |
| 144 " width='400' height='500' poster='snapshot1x.png' />" |
| 145 "<embed id='plugin_embed_srcset' type='application/x-ppapi-tests' " |
| 146 " width='400' height='500'" |
| 147 " poster='snapshot1x.png 1x, snapshot2x.png 2x' />"); |
| 148 |
| 149 EXPECT_TRUE(IsPluginPeripheral("plugin_src")); |
| 150 EXPECT_TRUE(IsPluginPeripheral("plugin_srcset")); |
| 151 EXPECT_TRUE(IsPluginPeripheral("plugin_legacy_syntax")); |
| 152 EXPECT_TRUE(IsPluginPeripheral("plugin_embed_src")); |
| 153 EXPECT_TRUE(IsPluginPeripheral("plugin_embed_srcset")); |
| 154 } |
| 155 |
| 156 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, |
| 157 PluginMarkedEssentialAfterPosterClicked) { |
131 LoadHTML( | 158 LoadHTML( |
132 "<object id='plugin' type='application/x-ppapi-tests' " | 159 "<object id='plugin' type='application/x-ppapi-tests' " |
133 " width='400' height='500'>" | 160 " width='400' height='100' poster='snapshot1x.png' />"); |
134 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x' />" | |
135 "</object>"); | |
136 EXPECT_TRUE(IsPluginPeripheral("plugin")); | |
137 } | |
138 | |
139 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, SmallPluginWithPoster) { | |
140 LoadHTML( | |
141 "<object id='plugin' type='application/x-ppapi-tests' " | |
142 " width='400' height='100'>" | |
143 " <param name='poster' value='snapshot1x.png 1x, snapshot2x.png 2x' />" | |
144 "</object>"); | |
145 EXPECT_TRUE(IsPluginPeripheral("plugin")); | 161 EXPECT_TRUE(IsPluginPeripheral("plugin")); |
146 | 162 |
147 SimulateClickAndAwaitMarkedEssential("plugin", gfx::Point(50, 50)); | 163 SimulateClickAndAwaitMarkedEssential("plugin", gfx::Point(50, 50)); |
148 } | 164 } |
149 | 165 |
150 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, OriginWhitelisting) { | 166 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, OriginWhitelisting) { |
151 LoadHTML( | 167 LoadHTML( |
152 "<object id='plugin1' data='http://otherorigin.com/fake1.swf' " | 168 "<object id='plugin1' data='http://otherorigin.com/fake1.swf' " |
153 "type='application/x-ppapi-tests' width='400' height='100'></object>" | 169 "type='application/x-ppapi-tests' width='400' height='100'></object>" |
154 "<object id='plugin2' data='http://otherorigin.com/fake2.swf' " | 170 "<object id='plugin2' data='http://otherorigin.com/fake2.swf' " |
155 "type='application/x-ppapi-tests' width='400' height='500'></object>"); | 171 "type='application/x-ppapi-tests' width='400' height='500'></object>"); |
156 EXPECT_FALSE(IsPluginPeripheral("plugin1")); | 172 EXPECT_FALSE(IsPluginPeripheral("plugin1")); |
157 EXPECT_FALSE(IsPluginPeripheral("plugin2")); | 173 EXPECT_FALSE(IsPluginPeripheral("plugin2")); |
158 } | 174 } |
159 | 175 |
160 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOriginObscured) { | 176 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, LargeCrossOriginObscured) { |
161 LoadHTML( | 177 LoadHTML( |
162 "<div style='width: 100px; height: 100px; overflow: hidden;'>" | 178 "<div style='width: 100px; height: 100px; overflow: hidden;'>" |
163 " <object id='plugin' data='http://otherorigin.com/fake.swf' " | 179 " <object id='plugin' data='http://otherorigin.com/fake.swf' " |
164 " type='application/x-ppapi-tests' width='400' height='500'></object>" | 180 " type='application/x-ppapi-tests' width='400' height='500'></object>" |
165 "</div>"); | 181 "</div>"); |
166 EXPECT_TRUE(IsPluginPeripheral("plugin")); | 182 EXPECT_TRUE(IsPluginPeripheral("plugin")); |
167 } | 183 } |
OLD | NEW |