| 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 "chrome/common/extensions/extension_manifest_constants.h" |
| 8 #include "extensions/common/install_warning.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 9 | 10 |
| 10 namespace keys = extension_manifest_keys; | 11 namespace keys = extension_manifest_keys; |
| 11 | 12 |
| 12 TEST_F(ExtensionManifestTest, OAuth2SectionParsing) { | 13 TEST_F(ExtensionManifestTest, OAuth2SectionParsing) { |
| 13 DictionaryValue base_manifest; | 14 DictionaryValue base_manifest; |
| 14 | 15 |
| 15 base_manifest.SetString(keys::kName, "test"); | 16 base_manifest.SetString(keys::kName, "test"); |
| 16 base_manifest.SetString(keys::kVersion, "0.1"); | 17 base_manifest.SetString(keys::kVersion, "0.1"); |
| 17 base_manifest.SetInteger(keys::kManifestVersion, 2); | 18 base_manifest.SetInteger(keys::kManifestVersion, 2); |
| 18 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); | 19 base_manifest.SetString(keys::kOAuth2ClientId, "client1"); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // OAuth2 section should NOT be parsed for a hosted app. | 58 // OAuth2 section should NOT be parsed for a hosted app. |
| 58 { | 59 { |
| 59 DictionaryValue app_manifest; | 60 DictionaryValue app_manifest; |
| 60 app_manifest.SetString(keys::kLaunchWebURL, "http://www.google.com"); | 61 app_manifest.SetString(keys::kLaunchWebURL, "http://www.google.com"); |
| 61 app_manifest.MergeDictionary(&base_manifest); | 62 app_manifest.MergeDictionary(&base_manifest); |
| 62 | 63 |
| 63 Manifest manifest(&app_manifest, "test"); | 64 Manifest manifest(&app_manifest, "test"); |
| 64 scoped_refptr<extensions::Extension> extension = | 65 scoped_refptr<extensions::Extension> extension = |
| 65 LoadAndExpectSuccess(manifest); | 66 LoadAndExpectSuccess(manifest); |
| 66 EXPECT_EQ(1U, extension->install_warnings().size()); | 67 EXPECT_EQ(1U, extension->install_warnings().size()); |
| 67 const extensions::Extension::InstallWarning& warning = | 68 const extensions::InstallWarning& warning = |
| 68 extension->install_warnings()[0]; | 69 extension->install_warnings()[0]; |
| 69 EXPECT_EQ("'oauth2' is only allowed for extensions, legacy packaged apps " | 70 EXPECT_EQ("'oauth2' is only allowed for extensions, legacy packaged apps " |
| 70 "and packaged apps, and this is a hosted app.", | 71 "and packaged apps, and this is a hosted app.", |
| 71 warning.message); | 72 warning.message); |
| 72 EXPECT_EQ("", extension->oauth2_info().client_id); | 73 EXPECT_EQ("", extension->oauth2_info().client_id); |
| 73 EXPECT_TRUE(extension->oauth2_info().scopes.empty()); | 74 EXPECT_TRUE(extension->oauth2_info().scopes.empty()); |
| 74 } | 75 } |
| 75 } | 76 } |
| OLD | NEW |