Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 EXPECT_TRUE(resource10.ComparePathWithDefault(expected_path)); 1185 EXPECT_TRUE(resource10.ComparePathWithDefault(expected_path));
1186 1186
1187 expected_patterns.ClearPatterns(); 1187 expected_patterns.ClearPatterns();
1188 AddPattern(&expected_patterns, "http://*.google.com/*"); 1188 AddPattern(&expected_patterns, "http://*.google.com/*");
1189 AddPattern(&expected_patterns, "https://*.google.com/*"); 1189 AddPattern(&expected_patterns, "https://*.google.com/*");
1190 EXPECT_EQ(expected_patterns, 1190 EXPECT_EQ(expected_patterns,
1191 extension->GetActivePermissions()->explicit_hosts()); 1191 extension->GetActivePermissions()->explicit_hosts());
1192 1192
1193 EXPECT_EQ(std::string(good1), loaded_[1]->id()); 1193 EXPECT_EQ(std::string(good1), loaded_[1]->id());
1194 EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name()); 1194 EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name());
1195 EXPECT_EQ(std::string(""), loaded_[1]->description()); 1195 EXPECT_EQ(std::string(), loaded_[1]->description());
1196 EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"), 1196 EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"),
1197 extensions::BackgroundInfo::GetBackgroundURL(loaded_[1])); 1197 extensions::BackgroundInfo::GetBackgroundURL(loaded_[1]));
1198 EXPECT_EQ( 1198 EXPECT_EQ(
1199 0u, extensions::ContentScriptsInfo::GetContentScripts(loaded_[1]).size()); 1199 0u, extensions::ContentScriptsInfo::GetContentScripts(loaded_[1]).size());
1200 1200
1201 // We don't parse the plugins section on Chrome OS. 1201 // We don't parse the plugins section on Chrome OS.
1202 #if defined(OS_CHROMEOS) 1202 #if defined(OS_CHROMEOS)
1203 EXPECT_TRUE(!extensions::PluginInfo::HasPlugins(loaded_[1])); 1203 EXPECT_TRUE(!extensions::PluginInfo::HasPlugins(loaded_[1]));
1204 #else 1204 #else
1205 ASSERT_TRUE(extensions::PluginInfo::HasPlugins(loaded_[1])); 1205 ASSERT_TRUE(extensions::PluginInfo::HasPlugins(loaded_[1]));
1206 const std::vector<extensions::PluginInfo>* plugins = 1206 const std::vector<extensions::PluginInfo>* plugins =
1207 extensions::PluginInfo::GetPlugins(loaded_[1]); 1207 extensions::PluginInfo::GetPlugins(loaded_[1]);
1208 ASSERT_TRUE(plugins); 1208 ASSERT_TRUE(plugins);
1209 ASSERT_EQ(2u, plugins->size()); 1209 ASSERT_EQ(2u, plugins->size());
1210 EXPECT_EQ(loaded_[1]->path().AppendASCII("content_plugin.dll").value(), 1210 EXPECT_EQ(loaded_[1]->path().AppendASCII("content_plugin.dll").value(),
1211 plugins->at(0).path.value()); 1211 plugins->at(0).path.value());
1212 EXPECT_TRUE(plugins->at(0).is_public); 1212 EXPECT_TRUE(plugins->at(0).is_public);
1213 EXPECT_EQ(loaded_[1]->path().AppendASCII("extension_plugin.dll").value(), 1213 EXPECT_EQ(loaded_[1]->path().AppendASCII("extension_plugin.dll").value(),
1214 plugins->at(1).path.value()); 1214 plugins->at(1).path.value());
1215 EXPECT_FALSE(plugins->at(1).is_public); 1215 EXPECT_FALSE(plugins->at(1).is_public);
1216 #endif 1216 #endif
1217 1217
1218 EXPECT_EQ(Manifest::INTERNAL, loaded_[1]->location()); 1218 EXPECT_EQ(Manifest::INTERNAL, loaded_[1]->location());
1219 1219
1220 int index = expected_num_extensions - 1; 1220 int index = expected_num_extensions - 1;
1221 EXPECT_EQ(std::string(good2), loaded_[index]->id()); 1221 EXPECT_EQ(std::string(good2), loaded_[index]->id());
1222 EXPECT_EQ(std::string("My extension 3"), loaded_[index]->name()); 1222 EXPECT_EQ(std::string("My extension 3"), loaded_[index]->name());
1223 EXPECT_EQ(std::string(""), loaded_[index]->description()); 1223 EXPECT_EQ(std::string(), loaded_[index]->description());
1224 EXPECT_EQ( 1224 EXPECT_EQ(
1225 0u, 1225 0u,
1226 extensions::ContentScriptsInfo::GetContentScripts(loaded_[index]).size()); 1226 extensions::ContentScriptsInfo::GetContentScripts(loaded_[index]).size());
1227 EXPECT_EQ(Manifest::INTERNAL, loaded_[index]->location()); 1227 EXPECT_EQ(Manifest::INTERNAL, loaded_[index]->location());
1228 }; 1228 };
1229 1229
1230 // Test loading bad extensions from the profile directory. 1230 // Test loading bad extensions from the profile directory.
1231 TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectoryFail) { 1231 TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectoryFail) {
1232 // Initialize the test dir with a bad Preferences/extensions. 1232 // Initialize the test dir with a bad Preferences/extensions.
1233 base::FilePath source_install_dir = data_dir_ 1233 base::FilePath source_install_dir = data_dir_
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 3306
3307 // Create a fake extension to be loaded as though it were read from prefs. 3307 // Create a fake extension to be loaded as though it were read from prefs.
3308 base::FilePath path = data_dir_.AppendASCII("management") 3308 base::FilePath path = data_dir_.AppendASCII("management")
3309 .AppendASCII("simple_extension"); 3309 .AppendASCII("simple_extension");
3310 DictionaryValue manifest; 3310 DictionaryValue manifest;
3311 manifest.SetString(keys::kName, "simple_extension"); 3311 manifest.SetString(keys::kName, "simple_extension");
3312 manifest.SetString(keys::kVersion, "1"); 3312 manifest.SetString(keys::kVersion, "1");
3313 // UNPACKED is for extensions loaded from a directory. We use it here, even 3313 // UNPACKED is for extensions loaded from a directory. We use it here, even
3314 // though we're testing loading from prefs, so that we don't need to provide 3314 // though we're testing loading from prefs, so that we don't need to provide
3315 // an extension key. 3315 // an extension key.
3316 extensions::ExtensionInfo extension_info(&manifest, "", path, 3316 extensions::ExtensionInfo extension_info(
3317 Manifest::UNPACKED); 3317 &manifest, std::string(), path, Manifest::UNPACKED);
3318 3318
3319 // Ensure we can load it with no management policy in place. 3319 // Ensure we can load it with no management policy in place.
3320 management_policy_->UnregisterAllProviders(); 3320 management_policy_->UnregisterAllProviders();
3321 EXPECT_EQ(0u, service_->extensions()->size()); 3321 EXPECT_EQ(0u, service_->extensions()->size());
3322 extensions::InstalledLoader(service_).Load(extension_info, false); 3322 extensions::InstalledLoader(service_).Load(extension_info, false);
3323 EXPECT_EQ(1u, service_->extensions()->size()); 3323 EXPECT_EQ(1u, service_->extensions()->size());
3324 3324
3325 const Extension* extension = *(service_->extensions()->begin()); 3325 const Extension* extension = *(service_->extensions()->begin());
3326 EXPECT_TRUE(service_->UninstallExtension(extension->id(), false, NULL)); 3326 EXPECT_TRUE(service_->UninstallExtension(extension->id(), false, NULL));
3327 EXPECT_EQ(0u, service_->extensions()->size()); 3327 EXPECT_EQ(0u, service_->extensions()->size());
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
5901 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); 5901 EXPECT_FALSE(extensions::HasExternalInstallError(service_));
5902 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); 5902 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx));
5903 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); 5903 EXPECT_TRUE(service_->IsExtensionEnabled(page_action));
5904 5904
5905 ExtensionPrefs* prefs = service_->extension_prefs(); 5905 ExtensionPrefs* prefs = service_->extension_prefs();
5906 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & 5906 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) &
5907 Extension::DISABLE_SIDELOAD_WIPEOUT); 5907 Extension::DISABLE_SIDELOAD_WIPEOUT);
5908 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & 5908 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) &
5909 Extension::DISABLE_SIDELOAD_WIPEOUT); 5909 Extension::DISABLE_SIDELOAD_WIPEOUT);
5910 } 5910 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols.cc ('k') | chrome/browser/extensions/extension_test_message_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698