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" |
11 #include "extensions/browser/extension_registry.h" | 11 #include "extensions/browser/extension_registry.h" |
12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
13 #include "extensions/common/extension_builder.h" | 13 #include "extensions/common/extension_builder.h" |
14 #include "extensions/common/test_util.h" | 14 #include "extensions/common/test_util.h" |
15 #include "extensions/common/value_builder.h" | 15 #include "extensions/common/value_builder.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Creates a very simple extension with a background page. | 21 // Creates a very simple extension with a background page. |
22 scoped_refptr<Extension> CreateExtensionWithBackgroundPage() { | 22 scoped_refptr<Extension> CreateExtensionWithBackgroundPage() { |
23 return ExtensionBuilder() | 23 return ExtensionBuilder() |
24 .SetManifest(std::move( | 24 .SetManifest(DictionaryBuilder() |
25 DictionaryBuilder() | 25 .Set("name", "test") |
26 .Set("name", "test") | 26 .Set("version", "0.1") |
27 .Set("version", "0.1") | 27 .Set("background", |
28 .Set("background", | 28 DictionaryBuilder().Set("page", "bg.html").Build()) |
29 std::move(DictionaryBuilder().Set("page", "bg.html"))))) | 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_(NULL), runtime_data_(®istry_) {} |
37 ~RuntimeDataTest() override {} | 37 ~RuntimeDataTest() override {} |
38 | 38 |
39 protected: | 39 protected: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 runtime_data_.OnExtensionUnloaded( | 98 runtime_data_.OnExtensionUnloaded( |
99 NULL, extension.get(), UnloadedExtensionInfo::REASON_DISABLE); | 99 NULL, extension.get(), UnloadedExtensionInfo::REASON_DISABLE); |
100 EXPECT_TRUE(runtime_data_.HasExtensionForTesting(extension->id())); | 100 EXPECT_TRUE(runtime_data_.HasExtensionForTesting(extension->id())); |
101 EXPECT_FALSE(runtime_data_.IsBackgroundPageReady(extension.get())); | 101 EXPECT_FALSE(runtime_data_.IsBackgroundPageReady(extension.get())); |
102 EXPECT_TRUE(runtime_data_.IsBeingUpgraded(extension->id())); | 102 EXPECT_TRUE(runtime_data_.IsBeingUpgraded(extension->id())); |
103 } | 103 } |
104 | 104 |
105 } // namespace | 105 } // namespace |
106 } // namespace extensions | 106 } // namespace extensions |
OLD | NEW |