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: | 16 protected: |
17 virtual void SetUp() OVERRIDE { | 17 virtual void SetUp() OVERRIDE { |
18 ManifestHandler::Register(extension_manifest_keys::kOAuth2, | 18 ExtensionManifestTest::SetUp(); |
19 make_linked_ptr(new OAuth2ManifestHandler)); | 19 (new OAuth2ManifestHandler)->Register(); |
20 } | 20 } |
21 }; | 21 }; |
22 | 22 |
23 TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { | 23 TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { |
24 base::DictionaryValue base_manifest; | 24 base::DictionaryValue base_manifest; |
25 | 25 |
26 base_manifest.SetString(keys::kName, "test"); | 26 base_manifest.SetString(keys::kName, "test"); |
27 base_manifest.SetString(keys::kVersion, "0.1"); | 27 base_manifest.SetString(keys::kVersion, "0.1"); |
28 base_manifest.SetInteger(keys::kManifestVersion, 2); | 28 base_manifest.SetInteger(keys::kManifestVersion, 2); |
29 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); | 29 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 extension->install_warnings()[0]; | 79 extension->install_warnings()[0]; |
80 EXPECT_EQ("'oauth2' is only allowed for extensions, legacy packaged apps " | 80 EXPECT_EQ("'oauth2' is only allowed for extensions, legacy packaged apps " |
81 "and packaged apps, and this is a hosted app.", | 81 "and packaged apps, and this is a hosted app.", |
82 warning.message); | 82 warning.message); |
83 EXPECT_EQ("", OAuth2Info::GetOAuth2Info(extension).client_id); | 83 EXPECT_EQ("", OAuth2Info::GetOAuth2Info(extension).client_id); |
84 EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension).scopes.empty()); | 84 EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension).scopes.empty()); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 } // namespace extensions | 88 } // namespace extensions |
OLD | NEW |