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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/safe_browsing/incident_reporting/extension_data_collect ion.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/extension_data_collect ion.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/install_signer.h" 15 #include "chrome/browser/extensions/install_signer.h"
16 #include "chrome/browser/extensions/test_extension_system.h" 16 #include "chrome/browser/extensions/test_extension_system.h"
17 #include "chrome/browser/prefs/browser_prefs.h" 17 #include "chrome/browser/prefs/browser_prefs.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/safe_browsing/csd.pb.h" 20 #include "chrome/common/safe_browsing/csd.pb.h"
21 #include "chrome/test/base/testing_browser_process.h" 21 #include "chrome/test/base/testing_browser_process.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "chrome/test/base/testing_profile_manager.h" 23 #include "chrome/test/base/testing_profile_manager.h"
24 #include "components/safe_browsing_db/safe_browsing_prefs.h" 24 #include "components/safe_browsing_db/safe_browsing_prefs.h"
25 #include "components/syncable_prefs/testing_pref_service_syncable.h" 25 #include "components/sync_preferences/testing_pref_service_syncable.h"
26 #include "content/public/test/test_browser_thread_bundle.h" 26 #include "content/public/test/test_browser_thread_bundle.h"
27 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
28 #include "extensions/browser/extension_prefs.h" 28 #include "extensions/browser/extension_prefs.h"
29 #include "extensions/browser/extension_registry.h" 29 #include "extensions/browser/extension_registry.h"
30 #include "extensions/common/extension.h" 30 #include "extensions/common/extension.h"
31 #include "extensions/common/extension_builder.h" 31 #include "extensions/common/extension_builder.h"
32 #include "extensions/common/extension_set.h" 32 #include "extensions/common/extension_set.h"
33 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 35
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 TestingBrowserProcess::DeleteInstance(); 139 TestingBrowserProcess::DeleteInstance();
140 testing::Test::TearDown(); 140 testing::Test::TearDown();
141 } 141 }
142 142
143 std::unique_ptr<ExtensionTestingProfile> CreateProfile( 143 std::unique_ptr<ExtensionTestingProfile> CreateProfile(
144 SafeBrowsingDisposition safe_browsing_opt_in) { 144 SafeBrowsingDisposition safe_browsing_opt_in) {
145 std::string profile_name("profile"); 145 std::string profile_name("profile");
146 profile_name.append(base::IntToString(++profile_number_)); 146 profile_name.append(base::IntToString(++profile_number_));
147 147
148 // Create prefs for the profile with safe browsing enabled or not. 148 // Create prefs for the profile with safe browsing enabled or not.
149 std::unique_ptr<syncable_prefs::TestingPrefServiceSyncable> prefs( 149 std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> prefs(
150 new syncable_prefs::TestingPrefServiceSyncable); 150 new sync_preferences::TestingPrefServiceSyncable);
151 chrome::RegisterUserProfilePrefs(prefs->registry()); 151 chrome::RegisterUserProfilePrefs(prefs->registry());
152 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, 152 prefs->SetBoolean(prefs::kSafeBrowsingEnabled,
153 safe_browsing_opt_in == SAFE_BROWSING_OPT_IN); 153 safe_browsing_opt_in == SAFE_BROWSING_OPT_IN);
154 safe_browsing::SetExtendedReportingPref( 154 safe_browsing::SetExtendedReportingPref(
155 prefs.get(), safe_browsing_opt_in == SAFE_BROWSING_OPT_IN); 155 prefs.get(), safe_browsing_opt_in == SAFE_BROWSING_OPT_IN);
156 TestingProfile* profile = profile_manager_->CreateTestingProfile( 156 TestingProfile* profile = profile_manager_->CreateTestingProfile(
157 profile_name, std::move(prefs), 157 profile_name, std::move(prefs),
158 base::UTF8ToUTF16(profile_name), // user_name 158 base::UTF8ToUTF16(profile_name), // user_name
159 0, // avatar_id 159 0, // avatar_id
160 std::string(), // supervised_user_id 160 std::string(), // supervised_user_id
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 ASSERT_TRUE(data.has_last_installed_extension()); 289 ASSERT_TRUE(data.has_last_installed_extension());
290 ClientIncidentReport_ExtensionData_ExtensionInfo extension_info = 290 ClientIncidentReport_ExtensionData_ExtensionInfo extension_info =
291 data.last_installed_extension(); 291 data.last_installed_extension();
292 292
293 ASSERT_EQ(extension_info.id(), extension_id); 293 ASSERT_EQ(extension_info.id(), extension_id);
294 ASSERT_EQ(extension_info.name(), extension_name); 294 ASSERT_EQ(extension_info.name(), extension_name);
295 } 295 }
296 296
297 } // namespace safe_browsing 297 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698