Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: content/renderer/pepper/pepper_graphics_2d_host_unittest.cc

Issue 654403002: Convert ARRAYSIZE_UNSAFE -> arraysize in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_graphics_2d_host.h" 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/renderer/pepper/gfx_conversion.h" 9 #include "content/renderer/pepper/gfx_conversion.h"
10 #include "content/renderer/pepper/mock_renderer_ppapi_host.h" 10 #include "content/renderer/pepper/mock_renderer_ppapi_host.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 {10, 11, 20, 20, 5, 5, 10, 11, 6, 4, 3, 2, 0.5, false}, 140 {10, 11, 20, 20, 5, 5, 10, 11, 6, 4, 3, 2, 0.5, false},
141 // Cannot scroll due to left 141 // Cannot scroll due to left
142 {7, 10, 20, 20, 3, 5, 11, 10, 6, 4, 3, 2, 0.5, false}, 142 {7, 10, 20, 20, 3, 5, 11, 10, 6, 4, 3, 2, 0.5, false},
143 // Cannot scroll due to width 143 // Cannot scroll due to width
144 {10, 10, 21, 20, 5, 5, 11, 10, 6, 4, 3, 2, 0.5, false}, 144 {10, 10, 21, 20, 5, 5, 11, 10, 6, 4, 3, 2, 0.5, false},
145 // Cannot scroll due to height 145 // Cannot scroll due to height
146 {10, 10, 20, 51, 5, 5, 10, 26, 6, 4, 3, 2, 0.5, false}, 146 {10, 10, 20, 51, 5, 5, 10, 26, 6, 4, 3, 2, 0.5, false},
147 // Check negative scroll deltas 147 // Check negative scroll deltas
148 {10, 10, 20, 20, 5, 5, 10, 10, -6, -4, -3, -2, 0.5, true}, 148 {10, 10, 20, 20, 5, 5, 10, 10, -6, -4, -3, -2, 0.5, true},
149 {10, 10, 20, 20, 5, 5, 10, 10, -6, -3, -3, -1, 0.5, false}, }; 149 {10, 10, 20, 20, 5, 5, 10, 10, -6, -3, -3, -1, 0.5, false}, };
150 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 150 for (size_t i = 0; i < arraysize(tests); ++i) {
151 gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1); 151 gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
152 gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2); 152 gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
153 gfx::Rect orig = r1; 153 gfx::Rect orig = r1;
154 gfx::Point delta(tests[i].dx1, tests[i].dy1); 154 gfx::Point delta(tests[i].dx1, tests[i].dy1);
155 bool res = ConvertToLogicalPixels(tests[i].scale, &r1, &delta); 155 bool res = ConvertToLogicalPixels(tests[i].scale, &r1, &delta);
156 EXPECT_EQ(r2.ToString(), r1.ToString()); 156 EXPECT_EQ(r2.ToString(), r1.ToString());
157 EXPECT_EQ(res, tests[i].result); 157 EXPECT_EQ(res, tests[i].result);
158 if (res) { 158 if (res) {
159 EXPECT_EQ(delta, gfx::Point(tests[i].dx2, tests[i].dy2)); 159 EXPECT_EQ(delta, gfx::Point(tests[i].dx2, tests[i].dy2));
160 } 160 }
161 // Reverse the scale and ensure all the original pixels are still inside 161 // Reverse the scale and ensure all the original pixels are still inside
162 // the result. 162 // the result.
163 ConvertToLogicalPixels(1.0f / tests[i].scale, &r1, NULL); 163 ConvertToLogicalPixels(1.0f / tests[i].scale, &r1, NULL);
164 EXPECT_TRUE(r1.Contains(orig)); 164 EXPECT_TRUE(r1.Contains(orig));
165 } 165 }
166 } 166 }
167 167
168 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/peer_connection_dependency_factory.cc ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698