diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 21:28:49 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 21:28:49 +0000 |
commit | f971f9cabdcf9aaa46c12f598fa15241d2fa47cf (patch) | |
tree | 32ffcfaacd2ec52e67081e2032242578e698dabc /extensions/browser/extension_registry_unittest.cc | |
parent | af01a3b5c3fe0471bde8425b618113ba5717853a (diff) | |
download | chromium_src-f971f9cabdcf9aaa46c12f598fa15241d2fa47cf.zip chromium_src-f971f9cabdcf9aaa46c12f598fa15241d2fa47cf.tar.gz chromium_src-f971f9cabdcf9aaa46c12f598fa15241d2fa47cf.tar.bz2 |
Create extensions_test_support build target
* Create extensions/common/test_util.h for shared test code
* Consolidate duplicated CreateExtensionWithID() functions
* Create extensions_test_support build target because you can't have multiple
files named test_util.h in a single build target on MSVS, all the other
names are taken (test_utils.h, extension_test_util.h, etc.), and this gets
us a step closer to having an extensions-only test suite.
* Fix some missing dependencies for the extensions_common target
* Remove unnecessary includes that create a dependency on themes
BUG=none
TEST=compiles, unit_tests
TBR=thakis@chromium.org for mechanical changes to chrome/browser/ui/cocoa/extensions/
Review URL: https://codereview.chromium.org/110463003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/extension_registry_unittest.cc')
-rw-r--r-- | extensions/browser/extension_registry_unittest.cc | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/extensions/browser/extension_registry_unittest.cc b/extensions/browser/extension_registry_unittest.cc index 4243dea..15c08e2 100644 --- a/extensions/browser/extension_registry_unittest.cc +++ b/extensions/browser/extension_registry_unittest.cc @@ -6,34 +6,22 @@ #include <string> -#include "base/files/file_path.h" #include "base/memory/ref_counted.h" -#include "base/values.h" #include "extensions/common/extension.h" -#include "extensions/common/extension_builder.h" -#include "extensions/common/value_builder.h" +#include "extensions/common/test_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { namespace { -// Creates a very simple extension. -scoped_refptr<Extension> CreateExtensionWithID(const std::string& id) { - return ExtensionBuilder() - .SetManifest( - DictionaryBuilder().Set("name", "Echo").Set("version", "1.0")) - .SetID(id) - .Build(); -} - typedef testing::Test ExtensionRegistryTest; TEST_F(ExtensionRegistryTest, FillAndClearRegistry) { ExtensionRegistry registry; - scoped_refptr<Extension> extension1 = CreateExtensionWithID("id1"); - scoped_refptr<Extension> extension2 = CreateExtensionWithID("id2"); - scoped_refptr<Extension> extension3 = CreateExtensionWithID("id3"); - scoped_refptr<Extension> extension4 = CreateExtensionWithID("id4"); + scoped_refptr<Extension> extension1 = test_util::CreateExtensionWithID("id1"); + scoped_refptr<Extension> extension2 = test_util::CreateExtensionWithID("id2"); + scoped_refptr<Extension> extension3 = test_util::CreateExtensionWithID("id3"); + scoped_refptr<Extension> extension4 = test_util::CreateExtensionWithID("id4"); // All the sets start empty. EXPECT_EQ(0u, registry.enabled_extensions().size()); @@ -66,7 +54,7 @@ TEST_F(ExtensionRegistryTest, AddAndRemoveExtensionFromRegistry) { ExtensionRegistry registry; // Adding an extension works. - scoped_refptr<Extension> extension = CreateExtensionWithID("id"); + scoped_refptr<Extension> extension = test_util::CreateExtensionWithID("id"); EXPECT_TRUE(registry.AddEnabled(extension)); EXPECT_EQ(1u, registry.enabled_extensions().size()); @@ -85,7 +73,7 @@ TEST_F(ExtensionRegistryTest, AddAndRemoveExtensionFromRegistry) { TEST_F(ExtensionRegistryTest, AddExtensionToRegistryTwice) { ExtensionRegistry registry; - scoped_refptr<Extension> extension = CreateExtensionWithID("id"); + scoped_refptr<Extension> extension = test_util::CreateExtensionWithID("id"); // An extension can exist in two sets at once. It would be nice to eliminate // this functionality, but some users of ExtensionRegistry need it. |