| 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/runtime_data.h" | 5 #include "extensions/browser/runtime_data.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "extensions/browser/extension_registry.h" | 10 #include "extensions/browser/extension_registry.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 DictionaryBuilder() | 24 DictionaryBuilder() |
| 25 .Set("name", "test") | 25 .Set("name", "test") |
| 26 .Set("version", "0.1") | 26 .Set("version", "0.1") |
| 27 .Set("background", DictionaryBuilder().Set("page", "bg.html"))) | 27 .Set("background", DictionaryBuilder().Set("page", "bg.html"))) |
| 28 .SetID("id2") | 28 .SetID("id2") |
| 29 .Build(); | 29 .Build(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 class RuntimeDataTest : public testing::Test { | 32 class RuntimeDataTest : public testing::Test { |
| 33 public: | 33 public: |
| 34 RuntimeDataTest() : registry_(NULL), runtime_data_(®istry_) {} | 34 RuntimeDataTest() : registry_(nullptr), runtime_data_(®istry_) {} |
| 35 virtual ~RuntimeDataTest() {} | 35 virtual ~RuntimeDataTest() {} |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 ExtensionRegistry registry_; | 38 ExtensionRegistry registry_; |
| 39 RuntimeData runtime_data_; | 39 RuntimeData runtime_data_; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 DISALLOW_COPY_AND_ASSIGN(RuntimeDataTest); | 42 DISALLOW_COPY_AND_ASSIGN(RuntimeDataTest); |
| 43 }; | 43 }; |
| 44 | 44 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 EXPECT_FALSE(runtime_data_.HasUsedWebRequest(extension.get())); | 85 EXPECT_FALSE(runtime_data_.HasUsedWebRequest(extension.get())); |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Unloading an extension stops tracking it. | 88 // Unloading an extension stops tracking it. |
| 89 TEST_F(RuntimeDataTest, OnExtensionUnloaded) { | 89 TEST_F(RuntimeDataTest, OnExtensionUnloaded) { |
| 90 scoped_refptr<Extension> extension = CreateExtensionWithBackgroundPage(); | 90 scoped_refptr<Extension> extension = CreateExtensionWithBackgroundPage(); |
| 91 runtime_data_.SetBackgroundPageReady(extension.get(), true); | 91 runtime_data_.SetBackgroundPageReady(extension.get(), true); |
| 92 ASSERT_TRUE(runtime_data_.HasExtensionForTesting(extension.get())); | 92 ASSERT_TRUE(runtime_data_.HasExtensionForTesting(extension.get())); |
| 93 | 93 |
| 94 runtime_data_.OnExtensionUnloaded( | 94 runtime_data_.OnExtensionUnloaded( |
| 95 NULL, extension.get(), UnloadedExtensionInfo::REASON_DISABLE); | 95 nullptr, extension.get(), UnloadedExtensionInfo::REASON_DISABLE); |
| 96 EXPECT_FALSE(runtime_data_.HasExtensionForTesting(extension.get())); | 96 EXPECT_FALSE(runtime_data_.HasExtensionForTesting(extension.get())); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace | 99 } // namespace |
| 100 } // namespace extensions | 100 } // namespace extensions |
| OLD | NEW |