| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" | 8 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
| 9 #include "chrome/common/extensions/extension_manifest_constants.h" | 9 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 10 | 10 |
| 11 namespace keys = extension_manifest_keys; | 11 namespace keys = extension_manifest_keys; |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 | 14 |
| 15 class OAuth2ManifestTest : public ExtensionManifestTest { | 15 class OAuth2ManifestTest : public ExtensionManifestTest { |
| 16 protected: | |
| 17 virtual void SetUp() OVERRIDE { | |
| 18 ExtensionManifestTest::SetUp(); | |
| 19 (new OAuth2ManifestHandler)->Register(); | |
| 20 } | |
| 21 }; | 16 }; |
| 22 | 17 |
| 23 TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { | 18 TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { |
| 24 base::DictionaryValue base_manifest; | 19 base::DictionaryValue base_manifest; |
| 25 | 20 |
| 26 base_manifest.SetString(keys::kName, "test"); | 21 base_manifest.SetString(keys::kName, "test"); |
| 27 base_manifest.SetString(keys::kVersion, "0.1"); | 22 base_manifest.SetString(keys::kVersion, "0.1"); |
| 28 base_manifest.SetInteger(keys::kManifestVersion, 2); | 23 base_manifest.SetInteger(keys::kManifestVersion, 2); |
| 29 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); | 24 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); |
| 30 base::ListValue* scopes = new base::ListValue(); | 25 base::ListValue* scopes = new base::ListValue(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 extension->install_warnings()[0]; | 74 extension->install_warnings()[0]; |
| 80 EXPECT_EQ("'oauth2' is only allowed for extensions, legacy packaged apps " | 75 EXPECT_EQ("'oauth2' is only allowed for extensions, legacy packaged apps " |
| 81 "and packaged apps, and this is a hosted app.", | 76 "and packaged apps, and this is a hosted app.", |
| 82 warning.message); | 77 warning.message); |
| 83 EXPECT_EQ("", OAuth2Info::GetOAuth2Info(extension).client_id); | 78 EXPECT_EQ("", OAuth2Info::GetOAuth2Info(extension).client_id); |
| 84 EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension).scopes.empty()); | 79 EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension).scopes.empty()); |
| 85 } | 80 } |
| 86 } | 81 } |
| 87 | 82 |
| 88 } // namespace extensions | 83 } // namespace extensions |
| OLD | NEW |