| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 6 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
| 7 #include "chrome/common/extensions/extension_manifest_constants.h" | 7 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 8 #include "chrome/common/extensions/extension_unittest.h" | 8 #include "chrome/common/extensions/extension_unittest.h" |
| 9 #include "chrome/common/extensions/manifest.h" | 9 #include "chrome/common/extensions/manifest.h" |
| 10 #include "chrome/common/extensions/manifest_url_handler.h" | 10 #include "chrome/common/extensions/manifest_url_handler.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 source.SetString(keys::kUpdateURL, update_url.spec()); | 49 source.SetString(keys::kUpdateURL, update_url.spec()); |
| 50 } | 50 } |
| 51 if (!launch_url.is_empty()) { | 51 if (!launch_url.is_empty()) { |
| 52 source.SetString(keys::kLaunchWebURL, launch_url.spec()); | 52 source.SetString(keys::kLaunchWebURL, launch_url.spec()); |
| 53 } | 53 } |
| 54 if (type != THEME) { | 54 if (type != THEME) { |
| 55 source.SetBoolean(keys::kConvertedFromUserScript, type == USER_SCRIPT); | 55 source.SetBoolean(keys::kConvertedFromUserScript, type == USER_SCRIPT); |
| 56 ListValue* plugins = new ListValue(); | 56 ListValue* plugins = new ListValue(); |
| 57 for (int i = 0; i < num_plugins; ++i) { | 57 for (int i = 0; i < num_plugins; ++i) { |
| 58 DictionaryValue* plugin = new DictionaryValue(); | 58 DictionaryValue* plugin = new DictionaryValue(); |
| 59 plugin->SetString(keys::kPluginsPath, ""); | 59 plugin->SetString(keys::kPluginsPath, std::string()); |
| 60 plugins->Set(i, plugin); | 60 plugins->Set(i, plugin); |
| 61 } | 61 } |
| 62 source.Set(keys::kPlugins, plugins); | 62 source.Set(keys::kPlugins, plugins); |
| 63 } | 63 } |
| 64 | 64 |
| 65 std::string error; | 65 std::string error; |
| 66 scoped_refptr<Extension> extension = Extension::Create( | 66 scoped_refptr<Extension> extension = Extension::Create( |
| 67 extension_path, location, source, creation_flags, &error); | 67 extension_path, location, source, creation_flags, &error); |
| 68 EXPECT_TRUE(extension); | 68 EXPECT_TRUE(extension); |
| 69 EXPECT_EQ("", error); | 69 EXPECT_EQ("", error); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 Extension::NO_FLAGS)); | 151 Extension::NO_FLAGS)); |
| 152 EXPECT_TRUE(app->ShouldDisplayInAppLauncher()); | 152 EXPECT_TRUE(app->ShouldDisplayInAppLauncher()); |
| 153 EXPECT_TRUE(app->ShouldDisplayInNewTabPage()); | 153 EXPECT_TRUE(app->ShouldDisplayInNewTabPage()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 TEST_F(ExtensionSyncTypeTest, DisplayInXManifestProperties) { | 156 TEST_F(ExtensionSyncTypeTest, DisplayInXManifestProperties) { |
| 157 DictionaryValue manifest; | 157 DictionaryValue manifest; |
| 158 manifest.SetString(keys::kName, "TestComponentApp"); | 158 manifest.SetString(keys::kName, "TestComponentApp"); |
| 159 manifest.SetString(keys::kVersion, "0.0.0.0"); | 159 manifest.SetString(keys::kVersion, "0.0.0.0"); |
| 160 manifest.SetString(keys::kApp, "true"); | 160 manifest.SetString(keys::kApp, "true"); |
| 161 manifest.SetString(keys::kPlatformAppBackgroundPage, ""); | 161 manifest.SetString(keys::kPlatformAppBackgroundPage, std::string()); |
| 162 | 162 |
| 163 std::string error; | 163 std::string error; |
| 164 scoped_refptr<Extension> app; | 164 scoped_refptr<Extension> app; |
| 165 | 165 |
| 166 // Default to true. | 166 // Default to true. |
| 167 app = Extension::Create( | 167 app = Extension::Create( |
| 168 base::FilePath(), Manifest::COMPONENT, manifest, 0, &error); | 168 base::FilePath(), Manifest::COMPONENT, manifest, 0, &error); |
| 169 EXPECT_EQ(error, std::string()); | 169 EXPECT_EQ(error, std::string()); |
| 170 EXPECT_TRUE(app->ShouldDisplayInAppLauncher()); | 170 EXPECT_TRUE(app->ShouldDisplayInAppLauncher()); |
| 171 EXPECT_TRUE(app->ShouldDisplayInNewTabPage()); | 171 EXPECT_TRUE(app->ShouldDisplayInNewTabPage()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scoped_refptr<Extension> extension( | 240 scoped_refptr<Extension> extension( |
| 241 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), | 241 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), |
| 242 Manifest::INTERNAL, 2, base::FilePath(), | 242 Manifest::INTERNAL, 2, base::FilePath(), |
| 243 Extension::NO_FLAGS)); | 243 Extension::NO_FLAGS)); |
| 244 if (extension) | 244 if (extension) |
| 245 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); | 245 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); |
| 246 } | 246 } |
| 247 #endif // !defined(OS_CHROMEOS) | 247 #endif // !defined(OS_CHROMEOS) |
| 248 | 248 |
| 249 } // namespace extensions | 249 } // namespace extensions |
| OLD | NEW |