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

Side by Side Diff: components/omnibox/autocomplete_result_unittest.cc

Issue 658993002: Convert ARRAYSIZE_UNSAFE -> arraysize in components/. (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/omnibox/autocomplete_result.h" 5 #include "components/omnibox/autocomplete_result.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 { 1, 0, 500 }, 236 { 1, 0, 500 },
237 }; 237 };
238 TestData current[] = { 238 TestData current[] = {
239 { 2, 0, 400 }, 239 { 2, 0, 400 },
240 }; 240 };
241 TestData result[] = { 241 TestData result[] = {
242 { 2, 0, 400 }, 242 { 2, 0, 400 },
243 { 1, 0, 399 }, 243 { 1, 0, 399 },
244 }; 244 };
245 245
246 ASSERT_NO_FATAL_FAILURE( 246 ASSERT_NO_FATAL_FAILURE(RunCopyOldMatchesTest(last, arraysize(last),
247 RunCopyOldMatchesTest(last, ARRAYSIZE_UNSAFE(last), 247 current, arraysize(current),
248 current, ARRAYSIZE_UNSAFE(current), 248 result, arraysize(result)));
249 result, ARRAYSIZE_UNSAFE(result)));
250 } 249 }
251 250
252 // Tests that matches are copied correctly from two distinct providers. 251 // Tests that matches are copied correctly from two distinct providers.
253 TEST_F(AutocompleteResultTest, CopyOldMatches2) { 252 TEST_F(AutocompleteResultTest, CopyOldMatches2) {
254 TestData last[] = { 253 TestData last[] = {
255 { 0, 0, 1000 }, 254 { 0, 0, 1000 },
256 { 1, 1, 500 }, 255 { 1, 1, 500 },
257 { 2, 0, 400 }, 256 { 2, 0, 400 },
258 { 3, 1, 300 }, 257 { 3, 1, 300 },
259 }; 258 };
260 TestData current[] = { 259 TestData current[] = {
261 { 4, 0, 1100 }, 260 { 4, 0, 1100 },
262 { 5, 1, 550 }, 261 { 5, 1, 550 },
263 }; 262 };
264 TestData result[] = { 263 TestData result[] = {
265 { 4, 0, 1100 }, 264 { 4, 0, 1100 },
266 { 5, 1, 550 }, 265 { 5, 1, 550 },
267 { 2, 0, 400 }, 266 { 2, 0, 400 },
268 { 3, 1, 300 }, 267 { 3, 1, 300 },
269 }; 268 };
270 269
271 ASSERT_NO_FATAL_FAILURE( 270 ASSERT_NO_FATAL_FAILURE(RunCopyOldMatchesTest(last, arraysize(last),
272 RunCopyOldMatchesTest(last, ARRAYSIZE_UNSAFE(last), 271 current, arraysize(current),
273 current, ARRAYSIZE_UNSAFE(current), 272 result, arraysize(result)));
274 result, ARRAYSIZE_UNSAFE(result)));
275 } 273 }
276 274
277 // Tests that matches with empty destination URLs aren't treated as duplicates 275 // Tests that matches with empty destination URLs aren't treated as duplicates
278 // and culled. 276 // and culled.
279 TEST_F(AutocompleteResultTest, SortAndCullEmptyDestinationURLs) { 277 TEST_F(AutocompleteResultTest, SortAndCullEmptyDestinationURLs) {
280 TestData data[] = { 278 TestData data[] = {
281 { 1, 0, 500 }, 279 { 1, 0, 500 },
282 { 0, 0, 1100 }, 280 { 0, 0, 1100 },
283 { 1, 0, 1000 }, 281 { 1, 0, 1000 },
284 { 0, 0, 1300 }, 282 { 0, 0, 1300 },
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 result.Reset(); 832 result.Reset();
835 matches.clear(); 833 matches.clear();
836 834
837 // Case 5: Multiple verbatim matches found in AutocompleteResult. 835 // Case 5: Multiple verbatim matches found in AutocompleteResult.
838 PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 836 PopulateAutocompleteMatchesFromTestData(kVerbatimMatches,
839 arraysize(kVerbatimMatches), 837 arraysize(kVerbatimMatches),
840 &matches); 838 &matches);
841 result.AppendMatches(matches); 839 result.AppendMatches(matches);
842 EXPECT_FALSE(result.ShouldHideTopMatch()); 840 EXPECT_FALSE(result.ShouldHideTopMatch());
843 } 841 }
OLDNEW
« no previous file with comments | « components/omnibox/autocomplete_match_unittest.cc ('k') | components/omnibox/keyword_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698