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

Unified Diff: chrome/browser/sync/test/integration/search_engines_helper.cc

Issue 9965143: Revert 130431 - Move the URL string from TemplateURLRef onto the owning TemplateURL. This will mak… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/search_engines_helper.cc
===================================================================
--- chrome/browser/sync/test/integration/search_engines_helper.cc (revision 130565)
+++ chrome/browser/sync/test/integration/search_engines_helper.cc (working copy)
@@ -47,18 +47,27 @@
std::string GetTURLInfoString(const TemplateURL* turl) {
DCHECK(turl);
- return "TemplateURL: shortname: " + UTF16ToASCII(turl->short_name()) +
- " keyword: " + UTF16ToASCII(turl->keyword()) + " url: " + turl->url();
+ std::string shortname = UTF16ToASCII(turl->short_name());
+ std::string keyword = UTF16ToASCII(turl->keyword());
+ return StringPrintf("TemplateURL: shortname: %s keyword: %s url: %s",
+ shortname.c_str(), keyword.c_str(),
+ (turl->url() ? turl->url()->url().c_str() : "NULL"));
}
bool TURLsMatch(const TemplateURL* turl1, const TemplateURL* turl2) {
CHECK(turl1);
CHECK(turl2);
- bool result = (turl1->url() == turl2->url()) &&
- (turl1->keyword() == turl2->keyword()) &&
- (turl1->short_name() == turl2->short_name());
+ // Either both TemplateURLRefs are NULL or they're both valid and have the
+ // same raw URL value.
+ bool urls_match = ((!turl1->url() && !turl1->url()) ||
+ (turl1->url() && turl2->url() &&
+ turl1->url()->url() == turl2->url()->url()));
+ // Compare all major fields.
+ bool result = (urls_match && turl1->keyword() == turl2->keyword() &&
+ turl1->short_name() == turl2->short_name());
+
// Print some useful debug info.
if (!result) {
LOG(ERROR) << "TemplateURLs did not match: " << GetTURLInfoString(turl1)
@@ -139,7 +148,7 @@
<< default_b->keyword();
return false;
} else {
- LOG(INFO) << "A had default with URL: " << default_a->url()
+ LOG(INFO) << "A had default with URL: " << default_a->url()->url()
<< " and keyword: " << default_a->keyword();
}

Powered by Google App Engine
This is Rietveld 408576698