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

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 114888)
+++ chrome/browser/extensions/extension_service_unittest.cc (working copy)
@@ -101,14 +101,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 utf8_error = UTF16ToUTF8(*iter);
+ if (utf8_error.find(".svn") == std::string::npos) {
ret_val.push_back(*iter);
}
}
@@ -652,7 +653,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)
@@ -667,7 +668,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;
}
@@ -710,7 +711,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();
@@ -1129,21 +1130,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
@@ -1419,7 +1424,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: "
@@ -2523,8 +2528,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;
}
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698