OLD | NEW |
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> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/extensions/install_signer.h" | 14 #include "chrome/browser/extensions/install_signer.h" |
13 #include "chrome/browser/extensions/test_extension_system.h" | 15 #include "chrome/browser/extensions/test_extension_system.h" |
14 #include "chrome/browser/prefs/browser_prefs.h" | 16 #include "chrome/browser/prefs/browser_prefs.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/safe_browsing/csd.pb.h" | 19 #include "chrome/common/safe_browsing/csd.pb.h" |
18 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
19 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
20 #include "chrome/test/base/testing_profile_manager.h" | 22 #include "chrome/test/base/testing_profile_manager.h" |
21 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 23 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
22 #include "content/public/test/test_browser_thread_bundle.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
23 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
24 #include "extensions/browser/extension_prefs.h" | 26 #include "extensions/browser/extension_prefs.h" |
25 #include "extensions/browser/extension_registry.h" | 27 #include "extensions/browser/extension_registry.h" |
26 #include "extensions/common/extension.h" | 28 #include "extensions/common/extension.h" |
27 #include "extensions/common/extension_builder.h" | 29 #include "extensions/common/extension_builder.h" |
28 #include "extensions/common/extension_set.h" | 30 #include "extensions/common/extension_set.h" |
29 | |
30 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
32 | 33 |
33 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
34 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 35 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
35 #include "chrome/browser/chromeos/settings/cros_settings.h" | 36 #include "chrome/browser/chromeos/settings/cros_settings.h" |
36 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 37 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
37 #endif | 38 #endif |
38 | 39 |
39 using ::testing::StrictMock; | 40 using ::testing::StrictMock; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 144 |
144 // Create prefs for the profile with safe browsing enabled or not. | 145 // Create prefs for the profile with safe browsing enabled or not. |
145 scoped_ptr<syncable_prefs::TestingPrefServiceSyncable> prefs( | 146 scoped_ptr<syncable_prefs::TestingPrefServiceSyncable> prefs( |
146 new syncable_prefs::TestingPrefServiceSyncable); | 147 new syncable_prefs::TestingPrefServiceSyncable); |
147 chrome::RegisterUserProfilePrefs(prefs->registry()); | 148 chrome::RegisterUserProfilePrefs(prefs->registry()); |
148 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, | 149 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, |
149 safe_browsing_opt_in == SAFE_BROWSING_OPT_IN); | 150 safe_browsing_opt_in == SAFE_BROWSING_OPT_IN); |
150 prefs->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled, | 151 prefs->SetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled, |
151 safe_browsing_opt_in == SAFE_BROWSING_OPT_IN); | 152 safe_browsing_opt_in == SAFE_BROWSING_OPT_IN); |
152 TestingProfile* profile = profile_manager_->CreateTestingProfile( | 153 TestingProfile* profile = profile_manager_->CreateTestingProfile( |
153 profile_name, prefs.Pass(), | 154 profile_name, std::move(prefs), |
154 base::UTF8ToUTF16(profile_name), // user_name | 155 base::UTF8ToUTF16(profile_name), // user_name |
155 0, // avatar_id | 156 0, // avatar_id |
156 std::string(), // supervised_user_id | 157 std::string(), // supervised_user_id |
157 TestingProfile::TestingFactories()); | 158 TestingProfile::TestingFactories()); |
158 | 159 |
159 return make_scoped_ptr(new ExtensionTestingProfile(profile)); | 160 return make_scoped_ptr(new ExtensionTestingProfile(profile)); |
160 } | 161 } |
161 | 162 |
162 content::TestBrowserThreadBundle browser_thread_bundle_; | 163 content::TestBrowserThreadBundle browser_thread_bundle_; |
163 scoped_ptr<TestingProfileManager> profile_manager_; | 164 scoped_ptr<TestingProfileManager> profile_manager_; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 285 |
285 ASSERT_TRUE(data.has_last_installed_extension()); | 286 ASSERT_TRUE(data.has_last_installed_extension()); |
286 ClientIncidentReport_ExtensionData_ExtensionInfo extension_info = | 287 ClientIncidentReport_ExtensionData_ExtensionInfo extension_info = |
287 data.last_installed_extension(); | 288 data.last_installed_extension(); |
288 | 289 |
289 ASSERT_EQ(extension_info.id(), extension_id); | 290 ASSERT_EQ(extension_info.id(), extension_id); |
290 ASSERT_EQ(extension_info.name(), extension_name); | 291 ASSERT_EQ(extension_info.name(), extension_name); |
291 } | 292 } |
292 | 293 |
293 } // namespace safe_browsing | 294 } // namespace safe_browsing |
OLD | NEW |