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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 base::string_as_array(&reference_data)), | 177 base::string_as_array(&reference_data)), |
178 reference_data.size(), gfx::PNGCodec::FORMAT_BGRA, | 178 reference_data.size(), gfx::PNGCodec::FORMAT_BGRA, |
179 &decoded, &w, &h)) { | 179 &decoded, &w, &h)) { |
180 return false; | 180 return false; |
181 } | 181 } |
182 | 182 |
183 if (w < kComparisonWidth || h < kComparisonHeight) | 183 if (w < kComparisonWidth || h < kComparisonHeight) |
184 return false; | 184 return false; |
185 | 185 |
186 int32_t* ref_pixels = reinterpret_cast<int32_t*>(decoded.data()); | 186 int32_t* ref_pixels = reinterpret_cast<int32_t*>(decoded.data()); |
187 SkAutoLockPixels lock_image(bitmap); | |
188 int32_t* pixels = static_cast<int32_t*>(bitmap.getPixels()); | 187 int32_t* pixels = static_cast<int32_t*>(bitmap.getPixels()); |
189 | 188 |
190 bool success = true; | 189 bool success = true; |
191 for (int y = 0; y < kComparisonHeight; ++y) { | 190 for (int y = 0; y < kComparisonHeight; ++y) { |
192 for (int x = 0; x < kComparisonWidth; ++x) { | 191 for (int x = 0; x < kComparisonWidth; ++x) { |
193 int32_t pixel = pixels[y * bitmap.rowBytes() / sizeof(int32_t) + x]; | 192 int32_t pixel = pixels[y * bitmap.rowBytes() / sizeof(int32_t) + x]; |
194 int pixel_b = pixel & 0xFF; | 193 int pixel_b = pixel & 0xFF; |
195 int pixel_g = (pixel >> 8) & 0xFF; | 194 int pixel_g = (pixel >> 8) & 0xFF; |
196 int pixel_r = (pixel >> 16) & 0xFF; | 195 int pixel_r = (pixel >> 16) & 0xFF; |
197 | 196 |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, | 645 IN_PROC_BROWSER_TEST_F(PluginPowerSaverPreferHtmlBrowserTest, |
647 ThrottlePluginsOnAllowContentSetting) { | 646 ThrottlePluginsOnAllowContentSetting) { |
648 HostContentSettingsMap* content_settings_map = | 647 HostContentSettingsMap* content_settings_map = |
649 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); | 648 HostContentSettingsMapFactory::GetForProfile(browser()->profile()); |
650 | 649 |
651 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, | 650 content_settings_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
652 CONTENT_SETTING_ALLOW); | 651 CONTENT_SETTING_ALLOW); |
653 LoadPeripheralPlugin(); | 652 LoadPeripheralPlugin(); |
654 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); | 653 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); |
655 } | 654 } |
OLD | NEW |