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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/test/values_test_util.h" | 7 #include "base/test/values_test_util.h" |
8 #include "extensions/common/manifest_constants.h" | 8 #include "extensions/common/manifest_constants.h" |
9 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" | 9 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" |
10 #include "extensions/common/manifest_test.h" | 10 #include "extensions/common/manifest_test.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 }; | 87 }; |
88 | 88 |
89 TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { | 89 TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { |
90 base::DictionaryValue base_manifest; | 90 base::DictionaryValue base_manifest; |
91 | 91 |
92 base_manifest.SetString(keys::kName, "test"); | 92 base_manifest.SetString(keys::kName, "test"); |
93 base_manifest.SetString(keys::kVersion, "0.1"); | 93 base_manifest.SetString(keys::kVersion, "0.1"); |
94 base_manifest.SetInteger(keys::kManifestVersion, 2); | 94 base_manifest.SetInteger(keys::kManifestVersion, 2); |
95 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); | 95 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); |
96 base::ListValue* scopes = new base::ListValue(); | 96 base::ListValue* scopes = new base::ListValue(); |
97 scopes->Append(new base::StringValue("scope1")); | 97 scopes->AppendString("scope1"); |
98 scopes->Append(new base::StringValue("scope2")); | 98 scopes->AppendString("scope2"); |
99 base_manifest.Set(keys::kOAuth2Scopes, scopes); | 99 base_manifest.Set(keys::kOAuth2Scopes, scopes); |
100 | 100 |
101 // OAuth2 section should be parsed for an extension. | 101 // OAuth2 section should be parsed for an extension. |
102 { | 102 { |
103 base::DictionaryValue ext_manifest; | 103 base::DictionaryValue ext_manifest; |
104 // Lack of "app" section representa an extension. So the base manifest | 104 // Lack of "app" section representa an extension. So the base manifest |
105 // itself represents an extension. | 105 // itself represents an extension. |
106 ext_manifest.MergeDictionary(&base_manifest); | 106 ext_manifest.MergeDictionary(&base_manifest); |
107 ext_manifest.SetString(keys::kKey, kExtensionKey); | 107 ext_manifest.SetString(keys::kKey, kExtensionKey); |
108 ext_manifest.SetBoolean(keys::kOAuth2AutoApprove, true); | 108 ext_manifest.SetBoolean(keys::kOAuth2AutoApprove, true); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { | 311 TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { |
312 std::unique_ptr<base::DictionaryValue> ext_manifest = | 312 std::unique_ptr<base::DictionaryValue> ext_manifest = |
313 CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); | 313 CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); |
314 ManifestData manifest(std::move(ext_manifest), "test"); | 314 ManifestData manifest(std::move(ext_manifest), "test"); |
315 scoped_refptr<extensions::Extension> extension = | 315 scoped_refptr<extensions::Extension> extension = |
316 LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); | 316 LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); |
317 EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); | 317 EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); |
318 } | 318 } |
319 | 319 |
320 } // namespace extensions | 320 } // namespace extensions |
OLD | NEW |