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

Side by Side Diff: chrome/browser/browsing_data/hosted_apps_counter_unittest.cc

Issue 2136373003: Move browsing data deletion prefs to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 4 years, 5 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 "chrome/browser/browsing_data/hosted_apps_counter.h" 5 #include "chrome/browser/browsing_data/hosted_apps_counter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/guid.h" 13 #include "base/guid.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
17 #include "components/browsing_data/browsing_data_utils.h" 16 #include "components/browsing_data/browsing_data_utils.h"
18 #include "components/browsing_data/pref_names.h" 17 #include "components/browsing_data/pref_names.h"
19 #include "components/crx_file/id_util.h" 18 #include "components/crx_file/id_util.h"
20 #include "components/prefs/pref_service.h" 19 #include "components/prefs/pref_service.h"
21 #include "extensions/browser/extension_registry.h" 20 #include "extensions/browser/extension_registry.h"
22 #include "extensions/common/extension_builder.h" 21 #include "extensions/common/extension_builder.h"
23 #include "extensions/common/value_builder.h" 22 #include "extensions/common/value_builder.h"
24 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
25 24
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return item->id(); 90 return item->id();
92 } 91 }
93 92
94 void RemoveItem(const std::string& id) { 93 void RemoveItem(const std::string& id) {
95 extension_registry_->RemoveEnabled(id); 94 extension_registry_->RemoveEnabled(id);
96 } 95 }
97 96
98 // Setting preferences. ------------------------------------------------------ 97 // Setting preferences. ------------------------------------------------------
99 98
100 void SetHostedAppsDeletionPref(bool value) { 99 void SetHostedAppsDeletionPref(bool value) {
101 GetProfile()->GetPrefs()->SetBoolean(prefs::kDeleteHostedAppsData, value); 100 GetProfile()->GetPrefs()->SetBoolean(
101 browsing_data::prefs::kDeleteHostedAppsData, value);
102 } 102 }
103 103
104 void SetDeletionPeriodPref(browsing_data::TimePeriod period) { 104 void SetDeletionPeriodPref(browsing_data::TimePeriod period) {
105 GetProfile()->GetPrefs()->SetInteger( 105 GetProfile()->GetPrefs()->SetInteger(
106 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period)); 106 browsing_data::prefs::kDeleteTimePeriod, static_cast<int>(period));
107 } 107 }
108 108
109 // Retrieving counter results. ----------------------------------------------- 109 // Retrieving counter results. -----------------------------------------------
110 110
111 browsing_data::BrowsingDataCounter::ResultInt GetNumHostedApps() { 111 browsing_data::BrowsingDataCounter::ResultInt GetNumHostedApps() {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_EQ("App 2", GetExamples().back()); 231 EXPECT_EQ("App 2", GetExamples().back());
232 232
233 AddHostedAppWithName("App 3"); 233 AddHostedAppWithName("App 3");
234 counter.Restart(); 234 counter.Restart();
235 EXPECT_EQ(2u, GetExamples().size()); 235 EXPECT_EQ(2u, GetExamples().size());
236 EXPECT_EQ("App 1", GetExamples().front()); 236 EXPECT_EQ("App 1", GetExamples().front());
237 EXPECT_EQ("App 2", GetExamples().back()); 237 EXPECT_EQ("App 2", GetExamples().back());
238 } 238 }
239 239
240 } // namespace 240 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/hosted_apps_counter.cc ('k') | chrome/browser/browsing_data/media_licenses_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698