| 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 21 matching lines...) Expand all Loading... |
| 32 DictionaryBuilder() | 32 DictionaryBuilder() |
| 33 .Set("name", "test") | 33 .Set("name", "test") |
| 34 .Set("version", "0.1") | 34 .Set("version", "0.1") |
| 35 .Set("background", DictionaryBuilder().Set("page", "bg.html"))) | 35 .Set("background", DictionaryBuilder().Set("page", "bg.html"))) |
| 36 .SetID("id2") | 36 .SetID("id2") |
| 37 .Build(); | 37 .Build(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 class RuntimeDataTest : public testing::Test { | 40 class RuntimeDataTest : public testing::Test { |
| 41 public: | 41 public: |
| 42 RuntimeDataTest() : runtime_data_(®istry_) {} | 42 RuntimeDataTest() : registry_(NULL), runtime_data_(®istry_) {} |
| 43 virtual ~RuntimeDataTest() {} | 43 virtual ~RuntimeDataTest() {} |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 ExtensionRegistry registry_; | 46 ExtensionRegistry registry_; |
| 47 RuntimeData runtime_data_; | 47 RuntimeData runtime_data_; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(RuntimeDataTest); | 50 DISALLOW_COPY_AND_ASSIGN(RuntimeDataTest); |
| 51 }; | 51 }; |
| 52 | 52 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 runtime_data_.SetHasUsedWebRequest(extension, false); | 93 runtime_data_.SetHasUsedWebRequest(extension, false); |
| 94 EXPECT_FALSE(runtime_data_.HasUsedWebRequest(extension)); | 94 EXPECT_FALSE(runtime_data_.HasUsedWebRequest(extension)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Unloading an extension stops tracking it. | 97 // Unloading an extension stops tracking it. |
| 98 TEST_F(RuntimeDataTest, OnExtensionUnloaded) { | 98 TEST_F(RuntimeDataTest, OnExtensionUnloaded) { |
| 99 scoped_refptr<Extension> extension = CreateExtensionWithBackgroundPage(); | 99 scoped_refptr<Extension> extension = CreateExtensionWithBackgroundPage(); |
| 100 runtime_data_.SetBackgroundPageReady(extension, true); | 100 runtime_data_.SetBackgroundPageReady(extension, true); |
| 101 ASSERT_TRUE(runtime_data_.HasExtensionForTesting(extension)); | 101 ASSERT_TRUE(runtime_data_.HasExtensionForTesting(extension)); |
| 102 | 102 |
| 103 runtime_data_.OnExtensionUnloaded(extension); | 103 runtime_data_.OnExtensionUnloaded(NULL, extension); |
| 104 EXPECT_FALSE(runtime_data_.HasExtensionForTesting(extension)); | 104 EXPECT_FALSE(runtime_data_.HasExtensionForTesting(extension)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace | 107 } // namespace |
| 108 } // namespace extensions | 108 } // namespace extensions |
| OLD | NEW |