| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/error_map.h" | 5 #include "extensions/browser/error_map.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "components/crx_file/id_util.h" | 10 #include "components/crx_file/id_util.h" |
| 11 #include "extensions/browser/extension_error.h" | 11 #include "extensions/browser/extension_error.h" |
| 12 #include "extensions/browser/extension_error_test_util.h" | 12 #include "extensions/browser/extension_error_test_util.h" |
| 13 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 using error_test_util::CreateNewRuntimeError; | 18 using error_test_util::CreateNewRuntimeError; |
| 19 | 19 |
| 20 class ErrorMapUnitTest : public testing::Test { | 20 class ErrorMapUnitTest : public testing::Test { |
| 21 public: | 21 public: |
| 22 ErrorMapUnitTest() { } | 22 ErrorMapUnitTest() { } |
| 23 virtual ~ErrorMapUnitTest() { } | 23 virtual ~ErrorMapUnitTest() { } |
| 24 | 24 |
| 25 virtual void SetUp() OVERRIDE { | 25 virtual void SetUp() override { |
| 26 testing::Test::SetUp(); | 26 testing::Test::SetUp(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 ErrorMap errors_; | 30 ErrorMap errors_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // Test adding errors, and removing them by reference, by incognito status, | 33 // Test adding errors, and removing them by reference, by incognito status, |
| 34 // and in bulk. | 34 // and in bulk. |
| 35 TEST_F(ErrorMapUnitTest, AddAndRemoveErrors) { | 35 TEST_F(ErrorMapUnitTest, AddAndRemoveErrors) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 const ErrorList& list = errors_.GetErrorsForExtension(kId); | 138 const ErrorList& list = errors_.GetErrorsForExtension(kId); |
| 139 ASSERT_EQ(kNumErrors, list.size()); | 139 ASSERT_EQ(kNumErrors, list.size()); |
| 140 | 140 |
| 141 // The duplicate error should be the last reported (pointer comparison)... | 141 // The duplicate error should be the last reported (pointer comparison)... |
| 142 ASSERT_EQ(weak_error, list.back()); | 142 ASSERT_EQ(weak_error, list.back()); |
| 143 // ... and should have two reported occurrences. | 143 // ... and should have two reported occurrences. |
| 144 ASSERT_EQ(2u, list.back()->occurrences()); | 144 ASSERT_EQ(2u, list.back()->occurrences()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace extensions | 147 } // namespace extensions |
| OLD | NEW |