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

Unified Diff: chrome/browser/search_engines/template_url_fetcher_unittest.cc

Issue 6291003: Revert 71485 - Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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/search_engines/template_url_fetcher_unittest.cc
===================================================================
--- chrome/browser/search_engines/template_url_fetcher_unittest.cc (revision 71499)
+++ chrome/browser/search_engines/template_url_fetcher_unittest.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/scoped_ptr.h"
-#include "base/utf_string_conversions.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/search_engines/template_url_fetcher_callbacks.h"
@@ -77,7 +76,7 @@
protected:
// Schedules the download of the url.
- void StartDownload(const string16& keyword,
+ void StartDownload(const std::wstring& keyword,
const std::string& osdd_file_name,
TemplateURLFetcher::ProviderType provider_type,
bool check_that_file_exists);
@@ -155,7 +154,7 @@
}
void TemplateURLFetcherTest::StartDownload(
- const string16& keyword,
+ const std::wstring& keyword,
const std::string& osdd_file_name,
TemplateURLFetcher::ProviderType provider_type,
bool check_that_file_exists) {
@@ -184,7 +183,7 @@
}
TEST_F(TemplateURLFetcherTest, BasicAutodetectedTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
test_util_.ChangeModelToLoadState();
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
@@ -204,13 +203,13 @@
const TemplateURL* t_url = test_util_.model()->GetTemplateURLForKeyword(
keyword);
ASSERT_TRUE(t_url);
- EXPECT_EQ(ASCIIToUTF16("http://example.com/%s/other_stuff"),
- t_url->url()->DisplayURL());
+ EXPECT_STREQ(L"http://example.com/%s/other_stuff",
+ t_url->url()->DisplayURL().c_str());
EXPECT_TRUE(t_url->safe_for_autoreplace());
}
TEST_F(TemplateURLFetcherTest, DuplicatesThrownAway) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
test_util_.ChangeModelToLoadState();
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
@@ -225,7 +224,7 @@
struct {
std::string description;
std::string osdd_file_name;
- string16 keyword;
+ std::wstring keyword;
TemplateURLFetcher::ProviderType provider_type;
} test_cases[] = {
{ "Duplicate keyword and osdd url with autodetected provider.",
@@ -233,8 +232,7 @@
{ "Duplicate keyword and osdd url with explicit provider.",
osdd_file_name, keyword, TemplateURLFetcher::EXPLICIT_PROVIDER },
{ "Duplicate osdd url with explicit provider.",
- osdd_file_name, keyword + ASCIIToUTF16("1"),
- TemplateURLFetcher::EXPLICIT_PROVIDER },
+ osdd_file_name, keyword + L"1", TemplateURLFetcher::EXPLICIT_PROVIDER },
{ "Duplicate keyword with explicit provider.",
osdd_file_name + "1", keyword, TemplateURLFetcher::EXPLICIT_PROVIDER }
};
@@ -257,7 +255,7 @@
}
TEST_F(TemplateURLFetcherTest, BasicExplicitTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
test_util_.ChangeModelToLoadState();
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
@@ -275,13 +273,13 @@
ASSERT_EQ(1, callbacks_destroyed_);
ASSERT_TRUE(last_callback_template_url_.get());
- EXPECT_EQ(ASCIIToUTF16("http://example.com/%s/other_stuff"),
- last_callback_template_url_->url()->DisplayURL());
+ EXPECT_STREQ(L"http://example.com/%s/other_stuff",
+ last_callback_template_url_->url()->DisplayURL().c_str());
EXPECT_FALSE(last_callback_template_url_->safe_for_autoreplace());
}
TEST_F(TemplateURLFetcherTest, BasicExplicitDefaultTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
test_util_.ChangeModelToLoadState();
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
@@ -299,13 +297,13 @@
ASSERT_EQ(1, callbacks_destroyed_);
ASSERT_TRUE(last_callback_template_url_.get());
- EXPECT_EQ(ASCIIToUTF16("http://example.com/%s/other_stuff"),
- last_callback_template_url_->url()->DisplayURL());
+ EXPECT_STREQ(L"http://example.com/%s/other_stuff",
+ last_callback_template_url_->url()->DisplayURL().c_str());
EXPECT_FALSE(last_callback_template_url_->safe_for_autoreplace());
}
TEST_F(TemplateURLFetcherTest, AutodetectedBeforeLoadTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
std::string osdd_file_name("simple_open_search.xml");
@@ -317,7 +315,7 @@
}
TEST_F(TemplateURLFetcherTest, ExplicitBeforeLoadTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
std::string osdd_file_name("simple_open_search.xml");
@@ -329,7 +327,7 @@
}
TEST_F(TemplateURLFetcherTest, ExplicitDefaultBeforeLoadTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
ASSERT_FALSE(test_util_.model()->GetTemplateURLForKeyword(keyword));
std::string osdd_file_name("simple_open_search.xml");
@@ -345,13 +343,13 @@
ASSERT_EQ(1, callbacks_destroyed_);
ASSERT_TRUE(last_callback_template_url_.get());
- EXPECT_EQ(ASCIIToUTF16("http://example.com/%s/other_stuff"),
- last_callback_template_url_->url()->DisplayURL());
+ EXPECT_STREQ(L"http://example.com/%s/other_stuff",
+ last_callback_template_url_->url()->DisplayURL().c_str());
EXPECT_FALSE(last_callback_template_url_->safe_for_autoreplace());
}
TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) {
- string16 keyword(ASCIIToUTF16("test"));
+ std::wstring keyword(L"test");
TemplateURL* t_url = new TemplateURL();
t_url->SetURL("http://example.com/", 0, 0);
@@ -386,5 +384,5 @@
ASSERT_EQ(0, add_provider_called_);
ASSERT_EQ(3, callbacks_destroyed_);
ASSERT_TRUE(last_callback_template_url_.get());
- ASSERT_NE(keyword, last_callback_template_url_->keyword());
+ ASSERT_STRNE(keyword.c_str(), last_callback_template_url_->keyword().c_str());
}
« no previous file with comments | « chrome/browser/search_engines/template_url_fetcher.cc ('k') | chrome/browser/search_engines/template_url_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698