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

Unified Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 8890086: Issue 71980: Extensions code should use UTF-16 for user-visible Unicode strings (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service_unittest.cc
===================================================================
--- chrome/browser/extensions/extension_service_unittest.cc (revision 114019)
+++ chrome/browser/extensions/extension_service_unittest.cc (working copy)
@@ -100,14 +100,15 @@
}
};
-static std::vector<std::string> GetErrors() {
- const std::vector<std::string>* errors =
+static std::vector<string16> GetErrors() {
+ const std::vector<string16>* errors =
ExtensionErrorReporter::GetInstance()->GetErrors();
- std::vector<std::string> ret_val;
+ std::vector<string16> ret_val;
- for (std::vector<std::string>::const_iterator iter = errors->begin();
+ for (std::vector<string16>::const_iterator iter = errors->begin();
iter != errors->end(); ++iter) {
- if (iter->find(".svn") == std::string::npos) {
+ std::string std_error = UTF16ToUTF8(*iter);
+ if (std_error.find(".svn") == std::string::npos) {
ret_val.push_back(*iter);
}
}
@@ -651,7 +652,7 @@
const Extension* WaitForCrxInstall(const FilePath& path,
InstallState install_state) {
loop_.RunAllPending();
- std::vector<std::string> errors = GetErrors();
+ std::vector<string16> errors = GetErrors();
const Extension* extension = NULL;
if (install_state != INSTALL_FAILED) {
if (install_state == INSTALL_NEW)
@@ -666,7 +667,7 @@
extension = loaded_[0];
EXPECT_TRUE(service_->GetExtensionById(extension->id(), false)) <<
path.value();
- for (std::vector<std::string>::iterator err = errors.begin();
+ for (std::vector<string16>::iterator err = errors.begin();
err != errors.end(); ++err) {
LOG(ERROR) << *err;
}
@@ -709,7 +710,7 @@
service_->UpdateExtension(id, path, GURL(), NULL);
loop_.RunAllPending();
- std::vector<std::string> errors = GetErrors();
+ std::vector<string16> errors = GetErrors();
int error_count = errors.size();
int enabled_extension_count =
service_->extensions()->size();
@@ -1128,21 +1129,25 @@
ASSERT_EQ(4u, GetErrors().size());
ASSERT_EQ(0u, loaded_.size());
- EXPECT_TRUE(MatchPattern(GetErrors()[0],
+ EXPECT_TRUE(MatchPattern(UTF16ToUTF8(GetErrors()[0]),
std::string("Could not load extension from '*'. ") +
- extension_manifest_errors::kManifestUnreadable)) << GetErrors()[0];
+ extension_manifest_errors::kManifestUnreadable)) <<
+ UTF16ToUTF8(GetErrors()[0]);
- EXPECT_TRUE(MatchPattern(GetErrors()[1],
+ EXPECT_TRUE(MatchPattern(UTF16ToUTF8(GetErrors()[1]),
std::string("Could not load extension from '*'. ") +
- extension_manifest_errors::kManifestUnreadable)) << GetErrors()[1];
+ extension_manifest_errors::kManifestUnreadable)) <<
+ UTF16ToUTF8(GetErrors()[1]);
- EXPECT_TRUE(MatchPattern(GetErrors()[2],
+ EXPECT_TRUE(MatchPattern(UTF16ToUTF8(GetErrors()[2]),
std::string("Could not load extension from '*'. ") +
- extension_manifest_errors::kMissingFile)) << GetErrors()[2];
+ extension_manifest_errors::kMissingFile)) <<
+ UTF16ToUTF8(GetErrors()[2]);
- EXPECT_TRUE(MatchPattern(GetErrors()[3],
+ EXPECT_TRUE(MatchPattern(UTF16ToUTF8(GetErrors()[3]),
std::string("Could not load extension from '*'. ") +
- extension_manifest_errors::kManifestUnreadable)) << GetErrors()[3];
+ extension_manifest_errors::kManifestUnreadable)) <<
+ UTF16ToUTF8(GetErrors()[3]);
};
// Test that partially deleted extensions are cleaned up during startup
@@ -1418,7 +1423,7 @@
GURL("http://www.aaronboodman.com/scripts/user_script_basic.user.js"));
loop_.RunAllPending();
- std::vector<std::string> errors = GetErrors();
+ std::vector<string16> errors = GetErrors();
EXPECT_TRUE(installed_) << "Nothing was installed.";
ASSERT_EQ(1u, loaded_.size()) << "Nothing was loaded.";
EXPECT_EQ(0u, errors.size()) << "There were errors: "
@@ -2522,8 +2527,8 @@
// Load extensions.
service_->Init();
- std::vector<std::string> errors = GetErrors();
- for (std::vector<std::string>::iterator err = errors.begin();
+ std::vector<string16> errors = GetErrors();
+ for (std::vector<string16>::iterator err = errors.begin();
err != errors.end(); ++err) {
LOG(ERROR) << *err;
}

Powered by Google App Engine
This is Rietveld 408576698