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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 .Set("version", "0.1") | 26 .Set("version", "0.1") |
27 .Set("background", | 27 .Set("background", |
28 DictionaryBuilder().Set("page", "bg.html").Build()) | 28 DictionaryBuilder().Set("page", "bg.html").Build()) |
29 .Build()) | 29 .Build()) |
30 .SetID("id2") | 30 .SetID("id2") |
31 .Build(); | 31 .Build(); |
32 } | 32 } |
33 | 33 |
34 class RuntimeDataTest : public testing::Test { | 34 class RuntimeDataTest : public testing::Test { |
35 public: | 35 public: |
36 RuntimeDataTest() : registry_(NULL), runtime_data_(®istry_) {} | 36 RuntimeDataTest() : registry_(nullptr), runtime_data_(®istry_) {} |
37 ~RuntimeDataTest() override {} | 37 ~RuntimeDataTest() override {} |
38 | 38 |
39 protected: | 39 protected: |
40 ExtensionRegistry registry_; | 40 ExtensionRegistry registry_; |
41 RuntimeData runtime_data_; | 41 RuntimeData runtime_data_; |
42 | 42 |
43 private: | 43 private: |
44 DISALLOW_COPY_AND_ASSIGN(RuntimeDataTest); | 44 DISALLOW_COPY_AND_ASSIGN(RuntimeDataTest); |
45 }; | 45 }; |
46 | 46 |
(...skipping 28 matching lines...) Expand all Loading... |
75 } | 75 } |
76 | 76 |
77 // Unloading an extension erases any data that shouldn't explicitly be kept | 77 // Unloading an extension erases any data that shouldn't explicitly be kept |
78 // across loads. | 78 // across loads. |
79 TEST_F(RuntimeDataTest, OnExtensionUnloaded) { | 79 TEST_F(RuntimeDataTest, OnExtensionUnloaded) { |
80 scoped_refptr<Extension> extension = CreateExtensionWithBackgroundPage(); | 80 scoped_refptr<Extension> extension = CreateExtensionWithBackgroundPage(); |
81 runtime_data_.SetBackgroundPageReady(extension->id(), true); | 81 runtime_data_.SetBackgroundPageReady(extension->id(), true); |
82 ASSERT_TRUE(runtime_data_.HasExtensionForTesting(extension->id())); | 82 ASSERT_TRUE(runtime_data_.HasExtensionForTesting(extension->id())); |
83 runtime_data_.SetBeingUpgraded(extension->id(), true); | 83 runtime_data_.SetBeingUpgraded(extension->id(), true); |
84 | 84 |
85 runtime_data_.OnExtensionUnloaded( | 85 runtime_data_.OnExtensionUnloaded(nullptr, extension.get(), |
86 NULL, extension.get(), UnloadedExtensionInfo::REASON_DISABLE); | 86 UnloadedExtensionReason::DISABLE); |
87 EXPECT_TRUE(runtime_data_.HasExtensionForTesting(extension->id())); | 87 EXPECT_TRUE(runtime_data_.HasExtensionForTesting(extension->id())); |
88 EXPECT_FALSE(runtime_data_.IsBackgroundPageReady(extension.get())); | 88 EXPECT_FALSE(runtime_data_.IsBackgroundPageReady(extension.get())); |
89 EXPECT_TRUE(runtime_data_.IsBeingUpgraded(extension->id())); | 89 EXPECT_TRUE(runtime_data_.IsBeingUpgraded(extension->id())); |
90 } | 90 } |
91 | 91 |
92 } // namespace | 92 } // namespace |
93 } // namespace extensions | 93 } // namespace extensions |
OLD | NEW |