| 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 14 matching lines...) Expand all Loading... |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| 27 using error_test_util::CreateNewManifestError; | 27 using error_test_util::CreateNewManifestError; |
| 28 using error_test_util::CreateNewRuntimeError; | 28 using error_test_util::CreateNewRuntimeError; |
| 29 | 29 |
| 30 class ErrorConsoleUnitTest : public testing::Test { | 30 class ErrorConsoleUnitTest : public testing::Test { |
| 31 public: | 31 public: |
| 32 ErrorConsoleUnitTest() : error_console_(NULL) { } | 32 ErrorConsoleUnitTest() : error_console_(NULL) { } |
| 33 virtual ~ErrorConsoleUnitTest() { } | 33 virtual ~ErrorConsoleUnitTest() { } |
| 34 | 34 |
| 35 virtual void SetUp() OVERRIDE { | 35 virtual void SetUp() override { |
| 36 testing::Test::SetUp(); | 36 testing::Test::SetUp(); |
| 37 | 37 |
| 38 // Errors are only kept if we have the FeatureSwitch and have Developer Mode | 38 // Errors are only kept if we have the FeatureSwitch and have Developer Mode |
| 39 // enabled. | 39 // enabled. |
| 40 FeatureSwitch::error_console()->SetOverrideValue( | 40 FeatureSwitch::error_console()->SetOverrideValue( |
| 41 FeatureSwitch::OVERRIDE_ENABLED); | 41 FeatureSwitch::OVERRIDE_ENABLED); |
| 42 profile_.reset(new TestingProfile); | 42 profile_.reset(new TestingProfile); |
| 43 profile_->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); | 43 profile_->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); |
| 44 error_console_ = ErrorConsole::Get(profile_.get()); | 44 error_console_ = ErrorConsole::Get(profile_.get()); |
| 45 } | 45 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 error_console_->ReportError( | 267 error_console_->ReportError( |
| 268 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); | 268 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); |
| 269 EXPECT_EQ(2u, // We should still have the first two errors. | 269 EXPECT_EQ(2u, // We should still have the first two errors. |
| 270 error_console_->GetErrorsForExtension( | 270 error_console_->GetErrorsForExtension( |
| 271 unpacked_extension->id()).size()); | 271 unpacked_extension->id()).size()); |
| 272 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( | 272 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( |
| 273 unpacked_extension->id())); | 273 unpacked_extension->id())); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace extensions | 276 } // namespace extensions |
| OLD | NEW |