| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "chrome/common/extensions/extension_manifest_constants.h" | 7 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 8 #include "chrome/common/extensions/features/feature.h" | 8 #include "chrome/common/extensions/features/feature.h" |
| 9 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" | 9 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" |
| 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 11 #include "extensions/common/error_utils.h" | 11 #include "extensions/common/error_utils.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using testing::ElementsAre; | 15 using testing::ElementsAre; |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 namespace errors = externally_connectable_errors; | 19 namespace errors = externally_connectable_errors; |
| 20 | 20 |
| 21 class ExternallyConnectableTest : public ExtensionManifestTest { | 21 class ExternallyConnectableTest : public ExtensionManifestTest { |
| 22 public: | 22 public: |
| 23 ExternallyConnectableTest() : channel_(chrome::VersionInfo::CHANNEL_DEV) {} | 23 ExternallyConnectableTest() : channel_(chrome::VersionInfo::CHANNEL_DEV) {} |
| 24 | 24 |
| 25 protected: | |
| 26 virtual void SetUp() OVERRIDE { | |
| 27 ExtensionManifestTest::SetUp(); | |
| 28 (new ExternallyConnectableHandler)->Register(); | |
| 29 } | |
| 30 | |
| 31 private: | 25 private: |
| 32 Feature::ScopedCurrentChannel channel_; | 26 Feature::ScopedCurrentChannel channel_; |
| 33 }; | 27 }; |
| 34 | 28 |
| 35 TEST_F(ExternallyConnectableTest, IDsAndMatches) { | 29 TEST_F(ExternallyConnectableTest, IDsAndMatches) { |
| 36 scoped_refptr<Extension> extension = | 30 scoped_refptr<Extension> extension = |
| 37 LoadAndExpectSuccess("externally_connectable_ids_and_matches.json"); | 31 LoadAndExpectSuccess("externally_connectable_ids_and_matches.json"); |
| 38 ASSERT_TRUE(extension); | 32 ASSERT_TRUE(extension); |
| 39 | 33 |
| 40 ExternallyConnectableInfo* info = ExternallyConnectableInfo::Get(extension); | 34 ExternallyConnectableInfo* info = ExternallyConnectableInfo::Get(extension); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 148 |
| 155 TEST_F(ExternallyConnectableTest, ErrorBadMatches) { | 149 TEST_F(ExternallyConnectableTest, ErrorBadMatches) { |
| 156 RunTestcase( | 150 RunTestcase( |
| 157 Testcase("externally_connectable_error_bad_matches.json", | 151 Testcase("externally_connectable_error_bad_matches.json", |
| 158 ErrorUtils::FormatErrorMessage(errors::kErrorInvalidMatchPattern, | 152 ErrorUtils::FormatErrorMessage(errors::kErrorInvalidMatchPattern, |
| 159 "www.yahoo.com")), | 153 "www.yahoo.com")), |
| 160 EXPECT_TYPE_ERROR); | 154 EXPECT_TYPE_ERROR); |
| 161 } | 155 } |
| 162 | 156 |
| 163 } // namespace extensions | 157 } // namespace extensions |
| OLD | NEW |