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

Unified Diff: chrome/browser/profiles/profile_statistics_unittest.cc

Issue 1579433002: Make profile statistics tasks inspectable by tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed gyp/gn files, also a few small changes Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_statistics_unittest.cc
diff --git a/chrome/browser/profiles/profile_statistics_unittest.cc b/chrome/browser/profiles/profile_statistics_unittest.cc
index e484b953260f76077d0468bf24fac8e4e6ad6ec9..5adc0a3d8a62b753099f187121f165bc1e6d652f 100644
--- a/chrome/browser/profiles/profile_statistics_unittest.cc
+++ b/chrome/browser/profiles/profile_statistics_unittest.cc
@@ -8,6 +8,8 @@
#include "base/files/file_path.h"
#include "chrome/browser/profiles/profile_statistics.h"
+#include "chrome/browser/profiles/profile_statistics_constants.h"
+#include "chrome/browser/profiles/profile_statistics_types.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
@@ -19,7 +21,7 @@ void VerifyStatisticsCache(const base::FilePath& profile_path,
const std::map<std::string, int>& expected,
const std::vector<std::string>& categories_to_check) {
const profiles::ProfileCategoryStats actual =
- profiles::GetProfileStatisticsFromCache(profile_path);
+ ProfileStatistics::GetProfileStatisticsFromCache(profile_path);
EXPECT_EQ(categories_to_check.size(), actual.size());
@@ -58,20 +60,18 @@ TEST_F(ProfileStatisticsTest, ProfileInfoCacheStorage) {
ASSERT_TRUE(profile);
base::FilePath profile_path = profile->GetPath();
- std::vector<std::string> categories_to_check{
- profiles::kProfileStatisticsBrowsingHistory,
- profiles::kProfileStatisticsPasswords,
- profiles::kProfileStatisticsBookmarks,
- profiles::kProfileStatisticsSettings
- };
+ std::vector<std::string> categories_to_check;
+ categories_to_check.push_back(profiles::kProfileStatisticsBrowsingHistory);
+ categories_to_check.push_back(profiles::kProfileStatisticsPasswords);
+ categories_to_check.push_back(profiles::kProfileStatisticsBookmarks);
+ categories_to_check.push_back(profiles::kProfileStatisticsSettings);
std::vector<std::pair<std::string, int>> insertions;
int num = 3;
// Insert for the first round, overwrite for the second round.
for (int i = 0; i < 2; i++) {
- for (const auto& category : categories_to_check) {
+ for (const auto& category : categories_to_check)
insertions.push_back(std::make_pair(category, num++));
- }
}
std::map<std::string, int> expected;
@@ -79,8 +79,8 @@ TEST_F(ProfileStatisticsTest, ProfileInfoCacheStorage) {
VerifyStatisticsCache(profile_path, expected, categories_to_check);
// Insert items and test after each insert.
for (const auto& item : insertions) {
- profiles::SetProfileStatisticsInCache(profile_path, item.first,
- item.second);
+ ProfileStatistics::SetProfileStatisticsInCache(profile_path, item.first,
+ item.second);
expected[item.first] = item.second;
VerifyStatisticsCache(profile_path, expected, categories_to_check);
}

Powered by Google App Engine
This is Rietveld 408576698