| 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" | |
| 8 #include "chrome/common/extensions/features/feature_channel.h" | 7 #include "chrome/common/extensions/features/feature_channel.h" |
| 9 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" | 8 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" |
| 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 9 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 11 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
| 11 #include "extensions/common/manifest_constants.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: | 25 protected: |
| 26 ExternallyConnectableInfo* GetExternallyConnectableInfo( | 26 ExternallyConnectableInfo* GetExternallyConnectableInfo( |
| 27 scoped_refptr<Extension> extension) { | 27 scoped_refptr<Extension> extension) { |
| 28 return static_cast<ExternallyConnectableInfo*>(extension->GetManifestData( | 28 return static_cast<ExternallyConnectableInfo*>(extension->GetManifestData( |
| 29 extension_manifest_keys::kExternallyConnectable)); | 29 manifest_keys::kExternallyConnectable)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 ScopedCurrentChannel channel_; | 33 ScopedCurrentChannel channel_; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 TEST_F(ExternallyConnectableTest, IDsAndMatches) { | 36 TEST_F(ExternallyConnectableTest, IDsAndMatches) { |
| 37 scoped_refptr<Extension> extension = | 37 scoped_refptr<Extension> extension = |
| 38 LoadAndExpectSuccess("externally_connectable_ids_and_matches.json"); | 38 LoadAndExpectSuccess("externally_connectable_ids_and_matches.json"); |
| 39 ASSERT_TRUE(extension.get()); | 39 ASSERT_TRUE(extension.get()); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 EXPECT_TRUE(info->matches.MatchesURL(GURL("https://example.com"))); | 281 EXPECT_TRUE(info->matches.MatchesURL(GURL("https://example.com"))); |
| 282 EXPECT_TRUE(info->matches.MatchesURL(GURL("http://build.chromium.org"))); | 282 EXPECT_TRUE(info->matches.MatchesURL(GURL("http://build.chromium.org"))); |
| 283 } | 283 } |
| 284 | 284 |
| 285 TEST_F(ExternallyConnectableTest, WarningNothingSpecified) { | 285 TEST_F(ExternallyConnectableTest, WarningNothingSpecified) { |
| 286 LoadAndExpectWarning("externally_connectable_nothing_specified.json", | 286 LoadAndExpectWarning("externally_connectable_nothing_specified.json", |
| 287 errors::kErrorNothingSpecified); | 287 errors::kErrorNothingSpecified); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace extensions | 290 } // namespace extensions |
| OLD | NEW |