| OLD | NEW |
| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 browsing_data::AutofillCounter::AutofillResult result( | 76 browsing_data::AutofillCounter::AutofillResult result( |
| 77 &counter, test_case.num_suggestions, test_case.num_credit_cards, | 77 &counter, test_case.num_suggestions, test_case.num_credit_cards, |
| 78 test_case.num_addresses); | 78 test_case.num_addresses); |
| 79 | 79 |
| 80 SCOPED_TRACE( | 80 SCOPED_TRACE( |
| 81 base::StringPrintf("Test params: %d credit card(s), " | 81 base::StringPrintf("Test params: %d credit card(s), " |
| 82 "%d address(es), %d suggestion(s).", | 82 "%d address(es), %d suggestion(s).", |
| 83 test_case.num_credit_cards, test_case.num_addresses, | 83 test_case.num_credit_cards, test_case.num_addresses, |
| 84 test_case.num_suggestions)); | 84 test_case.num_suggestions)); |
| 85 | 85 |
| 86 base::string16 output = browsing_data::GetCounterTextFromResult(&result); | 86 base::string16 output = browsing_data::GetCounterTextFromResult( |
| 87 &result, browsing_data::ClearBrowsingDataTab::ADVANCED); |
| 87 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output)); | 88 EXPECT_EQ(output, base::ASCIIToUTF16(test_case.expected_output)); |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| 91 TEST_F(BrowsingDataUtilsTest, MigratePreferencesToBasic) { | 92 TEST_F(BrowsingDataUtilsTest, MigratePreferencesToBasic) { |
| 92 using namespace browsing_data::prefs; | 93 using namespace browsing_data::prefs; |
| 93 | 94 |
| 94 prefs()->SetBoolean(kDeleteBrowsingHistory, true); | 95 prefs()->SetBoolean(kDeleteBrowsingHistory, true); |
| 95 prefs()->SetBoolean(kDeleteCookies, false); | 96 prefs()->SetBoolean(kDeleteCookies, false); |
| 96 prefs()->SetBoolean(kDeleteCache, false); | 97 prefs()->SetBoolean(kDeleteCache, false); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 109 prefs()->SetInteger(kDeleteTimePeriod, 100); | 110 prefs()->SetInteger(kDeleteTimePeriod, 100); |
| 110 | 111 |
| 111 // After the first migration all settings should stay the same if the | 112 // After the first migration all settings should stay the same if the |
| 112 // migration is executed again. | 113 // migration is executed again. |
| 113 browsing_data::MigratePreferencesToBasic(prefs()); | 114 browsing_data::MigratePreferencesToBasic(prefs()); |
| 114 EXPECT_TRUE(prefs()->GetBoolean(kDeleteBrowsingHistoryBasic)); | 115 EXPECT_TRUE(prefs()->GetBoolean(kDeleteBrowsingHistoryBasic)); |
| 115 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCookiesBasic)); | 116 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCookiesBasic)); |
| 116 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCacheBasic)); | 117 EXPECT_FALSE(prefs()->GetBoolean(kDeleteCacheBasic)); |
| 117 EXPECT_EQ(42, prefs()->GetInteger(kDeleteTimePeriodBasic)); | 118 EXPECT_EQ(42, prefs()->GetInteger(kDeleteTimePeriodBasic)); |
| 118 } | 119 } |
| OLD | NEW |