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 "base/test/values_test_util.h" | 5 #include "base/test/values_test_util.h" |
6 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" | 6 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
7 #include "chrome/common/extensions/extension_manifest_constants.h" | |
8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 7 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 8 #include "extensions/common/manifest_constants.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace keys = extensions::manifest_keys; | 11 namespace extensions { |
12 namespace errors = extension_manifest_errors; | 12 |
| 13 namespace keys = manifest_keys; |
| 14 namespace errors = manifest_errors; |
13 | 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 // Produces extension ID = "mdbihdcgjmagbcapkhhkjbbdlkflmbfo". | 18 // Produces extension ID = "mdbihdcgjmagbcapkhhkjbbdlkflmbfo". |
17 const char kExtensionKey[] = | 19 const char kExtensionKey[] = |
18 "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV9PlZjcTIXfnlB3HXo50OlM/CnIq0y7jm" | 20 "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV9PlZjcTIXfnlB3HXo50OlM/CnIq0y7jm" |
19 "KfPVyStaWsmFB7NaVnqUXoGb9swBDfVnZ6BrupwnxL76TWEJPo+KQMJ6uz0PPdJWi2jQfZiG" | 21 "KfPVyStaWsmFB7NaVnqUXoGb9swBDfVnZ6BrupwnxL76TWEJPo+KQMJ6uz0PPdJWi2jQfZiG" |
20 "iheDiKH5Gv+dVd67qf7ly8QWW0o8qmFpqBZQpksm1hOGbfsupv9W4c42tMEIicDMLQIDAQAB"; | 22 "iheDiKH5Gv+dVd67qf7ly8QWW0o8qmFpqBZQpksm1hOGbfsupv9W4c42tMEIicDMLQIDAQAB"; |
21 const char kAutoApproveNotAllowedWarning[] = | 23 const char kAutoApproveNotAllowedWarning[] = |
22 "'oauth2.auto_approve' is not allowed for specified extension ID."; | 24 "'oauth2.auto_approve' is not allowed for specified extension ID."; |
23 | 25 |
24 } // namespace | 26 } // namespace |
25 | 27 |
26 namespace extensions { | |
27 | |
28 class OAuth2ManifestTest : public ExtensionManifestTest { | 28 class OAuth2ManifestTest : public ExtensionManifestTest { |
29 protected: | 29 protected: |
30 enum AutoApproveValue { | 30 enum AutoApproveValue { |
31 AUTO_APPROVE_NOT_SET, | 31 AUTO_APPROVE_NOT_SET, |
32 AUTO_APPROVE_FALSE, | 32 AUTO_APPROVE_FALSE, |
33 AUTO_APPROVE_TRUE, | 33 AUTO_APPROVE_TRUE, |
34 AUTO_APPROVE_INVALID | 34 AUTO_APPROVE_INVALID |
35 }; | 35 }; |
36 | 36 |
37 enum ClientIdValue { | 37 enum ClientIdValue { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { | 313 TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { |
314 base::DictionaryValue* ext_manifest = | 314 base::DictionaryValue* ext_manifest = |
315 CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); | 315 CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); |
316 Manifest manifest(ext_manifest, "test"); | 316 Manifest manifest(ext_manifest, "test"); |
317 scoped_refptr<extensions::Extension> extension = | 317 scoped_refptr<extensions::Extension> extension = |
318 LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); | 318 LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); |
319 EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); | 319 EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); |
320 } | 320 } |
321 | 321 |
322 } // namespace extensions | 322 } // namespace extensions |
OLD | NEW |