| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void ExtensionTestingProfile::AddExtension(std::string extension_id, | 77 void ExtensionTestingProfile::AddExtension(std::string extension_id, |
| 78 std::string extension_name, | 78 std::string extension_name, |
| 79 base::Time install_time, | 79 base::Time install_time, |
| 80 std::string version, | 80 std::string version, |
| 81 std::string description, | 81 std::string description, |
| 82 std::string update_url, | 82 std::string update_url, |
| 83 int state_value) { | 83 int state_value) { |
| 84 scoped_refptr<extensions::Extension> extension = | 84 scoped_refptr<extensions::Extension> extension = |
| 85 extensions::ExtensionBuilder() | 85 extensions::ExtensionBuilder() |
| 86 .SetID(extension_id) | 86 .SetID(extension_id) |
| 87 .SetManifest(std::move(extensions::DictionaryBuilder() | 87 .SetManifest(extensions::DictionaryBuilder() |
| 88 .Set("name", extension_name) | 88 .Set("name", extension_name) |
| 89 .Set("version", version) | 89 .Set("version", version) |
| 90 .Set("manifest_version", 2) | 90 .Set("manifest_version", 2) |
| 91 .Set("description", description) | 91 .Set("description", description) |
| 92 .Set("update_url", update_url))) | 92 .Set("update_url", update_url) |
| 93 .Build()) |
| 93 .Build(); | 94 .Build(); |
| 94 | 95 |
| 95 // Install the extension on the faked extension service. | 96 // Install the extension on the faked extension service. |
| 96 extension_service_->AddExtension(extension.get()); | 97 extension_service_->AddExtension(extension.get()); |
| 97 | 98 |
| 98 extension_prefs_->UpdateExtensionPref( | 99 extension_prefs_->UpdateExtensionPref( |
| 99 extension_id, "install_time", new base::StringValue(base::Int64ToString( | 100 extension_id, "install_time", new base::StringValue(base::Int64ToString( |
| 100 install_time.ToInternalValue()))); | 101 install_time.ToInternalValue()))); |
| 101 extension_prefs_->UpdateExtensionPref( | 102 extension_prefs_->UpdateExtensionPref( |
| 102 extension_id, "state", new base::FundamentalValue(state_value)); | 103 extension_id, "state", new base::FundamentalValue(state_value)); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 286 |
| 286 ASSERT_TRUE(data.has_last_installed_extension()); | 287 ASSERT_TRUE(data.has_last_installed_extension()); |
| 287 ClientIncidentReport_ExtensionData_ExtensionInfo extension_info = | 288 ClientIncidentReport_ExtensionData_ExtensionInfo extension_info = |
| 288 data.last_installed_extension(); | 289 data.last_installed_extension(); |
| 289 | 290 |
| 290 ASSERT_EQ(extension_info.id(), extension_id); | 291 ASSERT_EQ(extension_info.id(), extension_id); |
| 291 ASSERT_EQ(extension_info.name(), extension_name); | 292 ASSERT_EQ(extension_info.name(), extension_name); |
| 292 } | 293 } |
| 293 | 294 |
| 294 } // namespace safe_browsing | 295 } // namespace safe_browsing |
| OLD | NEW |