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

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

Issue 1513043002: clang/win: Let remaining chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <algorithm> 5 #include <algorithm>
6 #include <fstream> 6 #include <fstream>
7 7
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 // transition types are what we expect. We don't bother checking 1024 // transition types are what we expect. We don't bother checking
1025 // the timestamps because it's too much trouble. (The timestamps go 1025 // the timestamps because it's too much trouble. (The timestamps go
1026 // through a transformation in InMemoryURLIndexTest::SetUp(). We 1026 // through a transformation in InMemoryURLIndexTest::SetUp(). We
1027 // assume that if the count and transitions show up with the right 1027 // assume that if the count and transitions show up with the right
1028 // information, we're getting the right information from the history 1028 // information, we're getting the right information from the history
1029 // database file.) 1029 // database file.)
1030 HistoryInfoMap::const_iterator entry = history_info_map.find(1); 1030 HistoryInfoMap::const_iterator entry = history_info_map.find(1);
1031 ASSERT_TRUE(entry != history_info_map.end()); 1031 ASSERT_TRUE(entry != history_info_map.end());
1032 { 1032 {
1033 const VisitInfoVector& visits = entry->second.visits; 1033 const VisitInfoVector& visits = entry->second.visits;
1034 EXPECT_EQ(3u, visits.size()); 1034 EXPECT_EQ(3u, visits.size());
Lei Zhang 2015/12/09 22:17:15 ASSERT_EQ(), ditto below, sigh.
Nico 2015/12/09 22:22:35 Done.
1035 EXPECT_EQ(0u, visits[0].second); 1035 EXPECT_EQ(static_cast<ui::PageTransition>(0u), visits[0].second);
Lei Zhang 2015/12/09 22:17:15 Maybe just use the enum values?
Nico 2015/12/09 22:22:35 I figured this uses literal ints to also test that
1036 EXPECT_EQ(1u, visits[1].second); 1036 EXPECT_EQ(static_cast<ui::PageTransition>(1u), visits[1].second);
1037 EXPECT_EQ(0u, visits[2].second); 1037 EXPECT_EQ(static_cast<ui::PageTransition>(0u), visits[2].second);
1038 } 1038 }
1039 1039
1040 // Ditto but for URL with id 35. 1040 // Ditto but for URL with id 35.
1041 entry = history_info_map.find(35); 1041 entry = history_info_map.find(35);
1042 ASSERT_TRUE(entry != history_info_map.end()); 1042 ASSERT_TRUE(entry != history_info_map.end());
1043 { 1043 {
1044 const VisitInfoVector& visits = entry->second.visits; 1044 const VisitInfoVector& visits = entry->second.visits;
1045 EXPECT_EQ(2u, visits.size()); 1045 EXPECT_EQ(2u, visits.size());
1046 EXPECT_EQ(1u, visits[0].second); 1046 EXPECT_EQ(static_cast<ui::PageTransition>(1u), visits[0].second);
1047 EXPECT_EQ(1u, visits[1].second); 1047 EXPECT_EQ(static_cast<ui::PageTransition>(1u), visits[1].second);
1048 } 1048 }
1049 1049
1050 // The URL with id 32 has many visits listed in the database, but we 1050 // The URL with id 32 has many visits listed in the database, but we
1051 // should only read the most recent 10 (which are all transition type 0). 1051 // should only read the most recent 10 (which are all transition type 0).
1052 entry = history_info_map.find(32); 1052 entry = history_info_map.find(32);
1053 ASSERT_TRUE(entry != history_info_map.end()); 1053 ASSERT_TRUE(entry != history_info_map.end());
1054 { 1054 {
1055 const VisitInfoVector& visits = entry->second.visits; 1055 const VisitInfoVector& visits = entry->second.visits;
1056 EXPECT_EQ(10u, visits.size()); 1056 EXPECT_EQ(10u, visits.size());
1057 for (size_t i = 0; i < visits.size(); ++i) 1057 for (size_t i = 0; i < visits.size(); ++i)
1058 EXPECT_EQ(0u, visits[i].second); 1058 EXPECT_EQ(static_cast<ui::PageTransition>(0u), visits[i].second);
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 TEST_F(InMemoryURLIndexTest, CacheSaveRestore) { 1062 TEST_F(InMemoryURLIndexTest, CacheSaveRestore) {
1063 base::ScopedTempDir temp_directory; 1063 base::ScopedTempDir temp_directory;
1064 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 1064 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
1065 set_history_dir(temp_directory.path()); 1065 set_history_dir(temp_directory.path());
1066 1066
1067 URLIndexPrivateData& private_data(*GetPrivateData()); 1067 URLIndexPrivateData& private_data(*GetPrivateData());
1068 1068
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); 1333 ASSERT_TRUE(GetCacheFilePath(&full_file_path));
1334 std::vector<base::FilePath::StringType> actual_parts; 1334 std::vector<base::FilePath::StringType> actual_parts;
1335 full_file_path.GetComponents(&actual_parts); 1335 full_file_path.GetComponents(&actual_parts);
1336 ASSERT_EQ(expected_parts.size(), actual_parts.size()); 1336 ASSERT_EQ(expected_parts.size(), actual_parts.size());
1337 size_t count = expected_parts.size(); 1337 size_t count = expected_parts.size();
1338 for (size_t i = 0; i < count; ++i) 1338 for (size_t i = 0; i < count; ++i)
1339 EXPECT_EQ(expected_parts[i], actual_parts[i]); 1339 EXPECT_EQ(expected_parts[i], actual_parts[i]);
1340 // Must clear the history_dir_ to satisfy the dtor's DCHECK. 1340 // Must clear the history_dir_ to satisfy the dtor's DCHECK.
1341 set_history_dir(base::FilePath()); 1341 set_history_dir(base::FilePath());
1342 } 1342 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/importer/ie_importer_browsertest_win.cc » ('j') | device/hid/hid_service_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698