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

Side by Side Diff: components/browsing_data/core/browsing_data_utils_unittest.cc

Issue 2855623005: Move browsing_data counter sync tests to separate file (Closed)
Patch Set: remove HistoryResult and PasswordResult Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/browsing_data/core/browsing_data_utils.h" 5 #include "components/browsing_data/core/browsing_data_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int num_passwords; 106 int num_passwords;
107 int is_synced; 107 int is_synced;
108 std::string expected_output; 108 std::string expected_output;
109 } kTestCases[] = { 109 } kTestCases[] = {
110 {0, false, "none"}, {0, true, "none"}, 110 {0, false, "none"}, {0, true, "none"},
111 {1, false, "1 password"}, {1, true, "1 password (synced)"}, 111 {1, false, "1 password"}, {1, true, "1 password (synced)"},
112 {5, false, "5 passwords"}, {5, true, "5 passwords (synced)"}, 112 {5, false, "5 passwords"}, {5, true, "5 passwords (synced)"},
113 }; 113 };
114 114
115 for (const TestCase& test_case : kTestCases) { 115 for (const TestCase& test_case : kTestCases) {
116 browsing_data::PasswordsCounter::PasswordResult result( 116 browsing_data::BrowsingDataCounter::SyncResult result(
117 &counter, test_case.num_passwords, test_case.is_synced); 117 &counter, test_case.num_passwords, test_case.is_synced);
118 SCOPED_TRACE(base::StringPrintf("Test params: %d password(s), %d is_synced", 118 SCOPED_TRACE(base::StringPrintf("Test params: %d password(s), %d is_synced",
119 test_case.num_passwords, 119 test_case.num_passwords,
120 test_case.is_synced)); 120 test_case.is_synced));
121 base::string16 output = browsing_data::GetCounterTextFromResult(&result); 121 base::string16 output = browsing_data::GetCounterTextFromResult(&result);
122 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output)); 122 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output));
123 } 123 }
124 store->ShutdownOnUIThread(); 124 store->ShutdownOnUIThread();
125 } 125 }
126 126
(...skipping 18 matching lines...) Expand all
145 prefs()->SetInteger(kDeleteTimePeriod, 100); 145 prefs()->SetInteger(kDeleteTimePeriod, 100);
146 146
147 // After the first migration all settings should stay the same if the 147 // After the first migration all settings should stay the same if the
148 // migration is executed again. 148 // migration is executed again.
149 browsing_data::MigratePreferencesToBasic(prefs()); 149 browsing_data::MigratePreferencesToBasic(prefs());
150 EXPECT_TRUE(prefs()->GetBoolean(kDeleteBrowsingHistoryBasic)); 150 EXPECT_TRUE(prefs()->GetBoolean(kDeleteBrowsingHistoryBasic));
151 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCookiesBasic)); 151 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCookiesBasic));
152 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCacheBasic)); 152 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCacheBasic));
153 EXPECT_EQ(42, prefs()->GetInteger(kDeleteTimePeriodBasic)); 153 EXPECT_EQ(42, prefs()->GetInteger(kDeleteTimePeriodBasic));
154 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698