OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/error_console/error_console.h" | 5 #include "chrome/browser/extensions/error_console/error_console.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // is tested more thoroughly in extensions/browser/error_map_unittest.cc | 131 // is tested more thoroughly in extensions/browser/error_map_unittest.cc |
132 TEST_F(ErrorConsoleUnitTest, ReportErrors) { | 132 TEST_F(ErrorConsoleUnitTest, ReportErrors) { |
133 const size_t kNumTotalErrors = 6; | 133 const size_t kNumTotalErrors = 6; |
134 const std::string kId = crx_file::id_util::GenerateId("id"); | 134 const std::string kId = crx_file::id_util::GenerateId("id"); |
135 error_console_->set_default_reporting_for_test(ExtensionError::MANIFEST_ERROR, | 135 error_console_->set_default_reporting_for_test(ExtensionError::MANIFEST_ERROR, |
136 true); | 136 true); |
137 ASSERT_EQ(0u, error_console_->GetErrorsForExtension(kId).size()); | 137 ASSERT_EQ(0u, error_console_->GetErrorsForExtension(kId).size()); |
138 | 138 |
139 for (size_t i = 0; i < kNumTotalErrors; ++i) { | 139 for (size_t i = 0; i < kNumTotalErrors; ++i) { |
140 error_console_->ReportError( | 140 error_console_->ReportError( |
141 CreateNewManifestError(kId, base::UintToString(i))); | 141 CreateNewManifestError(kId, base::SizeTToString(i))); |
142 } | 142 } |
143 | 143 |
144 ASSERT_EQ(kNumTotalErrors, error_console_->GetErrorsForExtension(kId).size()); | 144 ASSERT_EQ(kNumTotalErrors, error_console_->GetErrorsForExtension(kId).size()); |
145 } | 145 } |
146 | 146 |
147 TEST_F(ErrorConsoleUnitTest, DontStoreErrorsWithoutEnablingType) { | 147 TEST_F(ErrorConsoleUnitTest, DontStoreErrorsWithoutEnablingType) { |
148 // Disable default runtime error reporting, and enable default manifest error | 148 // Disable default runtime error reporting, and enable default manifest error |
149 // reporting. | 149 // reporting. |
150 error_console_->set_default_reporting_for_test(ExtensionError::RUNTIME_ERROR, | 150 error_console_->set_default_reporting_for_test(ExtensionError::RUNTIME_ERROR, |
151 false); | 151 false); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 error_console_->ReportError( | 270 error_console_->ReportError( |
271 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); | 271 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); |
272 EXPECT_EQ(2u, // We should still have the first two errors. | 272 EXPECT_EQ(2u, // We should still have the first two errors. |
273 error_console_->GetErrorsForExtension( | 273 error_console_->GetErrorsForExtension( |
274 unpacked_extension->id()).size()); | 274 unpacked_extension->id()).size()); |
275 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( | 275 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( |
276 unpacked_extension->id())); | 276 unpacked_extension->id())); |
277 } | 277 } |
278 | 278 |
279 } // namespace extensions | 279 } // namespace extensions |
OLD | NEW |