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

Unified Diff: chrome/browser/template_url_model_unittest.cc

Issue 14419: Porting in browser/webdata and template_url. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « chrome/browser/template_url_model.cc ('k') | chrome/browser/template_url_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/template_url_model_unittest.cc
===================================================================
--- chrome/browser/template_url_model_unittest.cc (revision 6978)
+++ chrome/browser/template_url_model_unittest.cc (working copy)
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <windows.h>
-
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -46,7 +44,7 @@
// Create a fresh, empty copy of this directory.
file_util::Delete(test_dir_, true);
- CreateDirectory(test_dir_.c_str(), NULL);
+ file_util::CreateDirectory(test_dir_);
std::wstring path = test_dir_;
file_util::AppendToPath(&path, L"TestDataService.db");
@@ -290,7 +288,7 @@
Time month_ago = now - TimeDelta::FromDays(30);
// Nothing has been added.
- EXPECT_EQ(0, model_->GetTemplateURLs().size());
+ EXPECT_EQ(0U, model_->GetTemplateURLs().size());
// Create one with a 0 time.
AddKeywordWithDate(L"key1", false, L"http://foo1", L"name1", true, Time());
@@ -305,22 +303,22 @@
AddKeywordWithDate(L"key6", false, L"http://foo6", L"name6", false, month_ago);
// We just added a few items, validate them.
- EXPECT_EQ(6, model_->GetTemplateURLs().size());
+ EXPECT_EQ(6U, model_->GetTemplateURLs().size());
// Try removing from current timestamp. This should delete the one in the
// future and one very recent one.
model_->RemoveAutoGeneratedSince(now);
- EXPECT_EQ(4, model_->GetTemplateURLs().size());
+ EXPECT_EQ(4U, model_->GetTemplateURLs().size());
// Try removing from two months ago. This should only delete items that are
// auto-generated.
model_->RemoveAutoGeneratedSince(now - TimeDelta::FromDays(60));
- EXPECT_EQ(3, model_->GetTemplateURLs().size());
+ EXPECT_EQ(3U, model_->GetTemplateURLs().size());
// Make sure the right values remain.
EXPECT_EQ(L"key1", model_->GetTemplateURLs()[0]->keyword());
EXPECT_TRUE(model_->GetTemplateURLs()[0]->safe_for_autoreplace());
- EXPECT_EQ(0, model_->GetTemplateURLs()[0]->date_created().ToInternalValue());
+ EXPECT_EQ(0U, model_->GetTemplateURLs()[0]->date_created().ToInternalValue());
EXPECT_EQ(L"key5", model_->GetTemplateURLs()[1]->keyword());
EXPECT_FALSE(model_->GetTemplateURLs()[1]->safe_for_autoreplace());
@@ -334,7 +332,7 @@
// Try removing from Time=0. This should delete one more.
model_->RemoveAutoGeneratedSince(Time());
- EXPECT_EQ(2, model_->GetTemplateURLs().size());
+ EXPECT_EQ(2U, model_->GetTemplateURLs().size());
}
TEST_F(TemplateURLModelTest, Reset) {
@@ -546,7 +544,7 @@
{ "http://blah/foo?x=y&x=z&y=z", true, "x;y", ";z" },
};
- for (size_t i = 0; i < arraysize(data); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
TemplateURLModel::QueryTerms terms;
ASSERT_EQ(data[i].result,
TemplateURLModel::BuildQueryTerms(GURL(data[i].url), &terms));
@@ -584,7 +582,7 @@
AddKeywordWithDate(L"x", false, L"http://x/foo?q={searchTerms}", L"name",
false, Time());
- for (size_t i = 0; i < arraysize(data); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
model_->UpdateKeywordSearchTermsForURL(history::URLRow(GURL(data[i].url)));
EXPECT_EQ(data[i].term, GetAndClearSearchTerm());
}
@@ -601,7 +599,7 @@
AddKeywordWithDate(L"x", false, L"http://x/foo", L"name", false, Time());
- for (size_t i = 0; i < arraysize(data); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
model_->UpdateKeywordSearchTermsForURL(history::URLRow(GURL(data[i].url)));
ASSERT_EQ(std::wstring(), GetAndClearSearchTerm());
}
« no previous file with comments | « chrome/browser/template_url_model.cc ('k') | chrome/browser/template_url_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698