| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 result_is_personal.push_back(suggestion->source != | 74 result_is_personal.push_back(suggestion->source != |
| 75 MostVisitedSites::POPULAR); | 75 MostVisitedSites::POPULAR); |
| 76 } | 76 } |
| 77 EXPECT_EQ(result_is_personal, expected_sites_is_personal); | 77 EXPECT_EQ(result_is_personal, expected_sites_is_personal); |
| 78 EXPECT_EQ(result_sites, expected_sites); | 78 EXPECT_EQ(result_sites, expected_sites); |
| 79 } | 79 } |
| 80 static scoped_ptr<MostVisitedSites::Suggestion> MakeSuggestionFrom( | 80 static scoped_ptr<MostVisitedSites::Suggestion> MakeSuggestionFrom( |
| 81 const TitleURL& title_url, | 81 const TitleURL& title_url, |
| 82 bool is_personal, | 82 bool is_personal, |
| 83 bool whitelist) { | 83 bool whitelist) { |
| 84 return make_scoped_ptr(new MostVisitedSites::Suggestion( | 84 scoped_ptr<MostVisitedSites::Suggestion> suggestion = |
| 85 title_url.title, title_url.url, | 85 make_scoped_ptr(new MostVisitedSites::Suggestion()); |
| 86 whitelist ? MostVisitedSites::WHITELIST | 86 suggestion->title = title_url.title; |
| 87 : (is_personal ? MostVisitedSites::TOP_SITES | 87 suggestion->url = GURL(title_url.url); |
| 88 : MostVisitedSites::POPULAR))); | 88 suggestion->source = whitelist ? MostVisitedSites::WHITELIST |
| 89 : (is_personal ? MostVisitedSites::TOP_SITES |
| 90 : MostVisitedSites::POPULAR); |
| 91 return suggestion; |
| 89 } | 92 } |
| 90 }; | 93 }; |
| 91 | 94 |
| 92 TEST_F(MostVisitedSitesTest, PersonalSitesDefaultOrder) { | 95 TEST_F(MostVisitedSitesTest, PersonalSitesDefaultOrder) { |
| 93 TitleURL personal[] = { | 96 TitleURL personal[] = { |
| 94 TitleURL("Site 1", "https://www.site1.com/"), | 97 TitleURL("Site 1", "https://www.site1.com/"), |
| 95 TitleURL("Site 2", "https://www.site2.com/"), | 98 TitleURL("Site 2", "https://www.site2.com/"), |
| 96 TitleURL("Site 3", "https://www.site3.com/"), | 99 TitleURL("Site 3", "https://www.site3.com/"), |
| 97 TitleURL("Site 4", "https://www.site4.com/"), | 100 TitleURL("Site 4", "https://www.site4.com/"), |
| 98 }; | 101 }; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 bool expected_source_is_personal[] = {false, true, true, false}; | 230 bool expected_source_is_personal[] = {false, true, true, false}; |
| 228 Check(std::vector<TitleURL>(popular, popular + arraysize(popular)), | 231 Check(std::vector<TitleURL>(popular, popular + arraysize(popular)), |
| 229 std::vector<TitleURL>(), | 232 std::vector<TitleURL>(), |
| 230 std::vector<TitleURL>(personal, personal + arraysize(personal)), | 233 std::vector<TitleURL>(personal, personal + arraysize(personal)), |
| 231 std::vector<std::string>(old, old + arraysize(old)), old_sites_source, | 234 std::vector<std::string>(old, old + arraysize(old)), old_sites_source, |
| 232 std::vector<bool>(expected_source_is_personal, | 235 std::vector<bool>(expected_source_is_personal, |
| 233 expected_source_is_personal + | 236 expected_source_is_personal + |
| 234 arraysize(expected_source_is_personal)), | 237 arraysize(expected_source_is_personal)), |
| 235 std::vector<TitleURL>(expected, expected + arraysize(expected))); | 238 std::vector<TitleURL>(expected, expected + arraysize(expected))); |
| 236 } | 239 } |
| OLD | NEW |