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" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return false; | 172 return false; |
173 } | 173 } |
174 | 174 |
175 std::string reference_data; | 175 std::string reference_data; |
176 if (!base::ReadFileToString(reference, &reference_data)) | 176 if (!base::ReadFileToString(reference, &reference_data)) |
177 return false; | 177 return false; |
178 | 178 |
179 int w = 0; | 179 int w = 0; |
180 int h = 0; | 180 int h = 0; |
181 std::vector<unsigned char> decoded; | 181 std::vector<unsigned char> decoded; |
182 if (!gfx::PNGCodec::Decode( | 182 if (!gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>( |
183 reinterpret_cast<unsigned char*>(string_as_array(&reference_data)), | 183 base::string_as_array(&reference_data)), |
184 reference_data.size(), gfx::PNGCodec::FORMAT_BGRA, &decoded, &w, | 184 reference_data.size(), gfx::PNGCodec::FORMAT_BGRA, |
185 &h)) { | 185 &decoded, &w, &h)) { |
186 return false; | 186 return false; |
187 } | 187 } |
188 | 188 |
189 if (w < kComparisonWidth || h < kComparisonHeight) | 189 if (w < kComparisonWidth || h < kComparisonHeight) |
190 return false; | 190 return false; |
191 | 191 |
192 int32_t* ref_pixels = reinterpret_cast<int32_t*>(decoded.data()); | 192 int32_t* ref_pixels = reinterpret_cast<int32_t*>(decoded.data()); |
193 SkAutoLockPixels lock_image(bitmap); | 193 SkAutoLockPixels lock_image(bitmap); |
194 int32_t* pixels = static_cast<int32_t*>(bitmap.getPixels()); | 194 int32_t* pixels = static_cast<int32_t*>(bitmap.getPixels()); |
195 | 195 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 std::string script = | 728 std::string script = |
729 "window.document.getElementById('expand_to_peripheral').height = 200;" | 729 "window.document.getElementById('expand_to_peripheral').height = 200;" |
730 "window.document.getElementById('expand_to_peripheral').width = 200;" | 730 "window.document.getElementById('expand_to_peripheral').width = 200;" |
731 "window.document.getElementById('expand_to_essential').height = 400;" | 731 "window.document.getElementById('expand_to_essential').height = 400;" |
732 "window.document.getElementById('expand_to_essential').width = 400;"; | 732 "window.document.getElementById('expand_to_essential').width = 400;"; |
733 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script)); | 733 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script)); |
734 | 734 |
735 VerifyPluginIsThrottled(GetActiveWebContents(), "expand_to_peripheral"); | 735 VerifyPluginIsThrottled(GetActiveWebContents(), "expand_to_peripheral"); |
736 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); | 736 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); |
737 } | 737 } |
OLD | NEW |