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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_match_unittest.cc

Issue 10700116: autocomplete: Extract AutocompleteMatch unittest from autocomplete_unittest.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autocomplete/autocomplete_match.h"
6
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 TEST(AutocompleteMatchTest, MoreRelevant) {
11 struct RelevantCases {
12 int r1;
13 int r2;
14 bool expected_result;
15 } cases[] = {
16 { 10, 0, true },
17 { 10, -5, true },
18 { -5, 10, false },
19 { 0, 10, false },
20 { -10, -5, false },
21 { -5, -10, true },
22 };
23
24 AutocompleteMatch m1(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED);
25 AutocompleteMatch m2(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED);
26
27 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
28 m1.relevance = cases[i].r1;
29 m2.relevance = cases[i].r2;
30 EXPECT_EQ(cases[i].expected_result,
31 AutocompleteMatch::MoreRelevant(m1, m2));
32 }
33 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698