summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 17:01:37 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 17:01:37 +0000
commit489d73e7fca72f29bd6620e268609133aa217795 (patch)
treea3ea497ed6b15be2d9742821dd4a2f36a0d885ce /chrome
parent60c413c96834553e182e8c9c34d1e8958f3b0fb5 (diff)
downloadchromium_src-489d73e7fca72f29bd6620e268609133aa217795.zip
chromium_src-489d73e7fca72f29bd6620e268609133aa217795.tar.gz
chromium_src-489d73e7fca72f29bd6620e268609133aa217795.tar.bz2
Run more unit tests on Linux:
- used string16 instead of wstring where needed - replaced GetTickCount calls with portable functions from base/time.h - misc GCC cleanups - enabled following unit tests on Linux: browser/autocomplete/history_contents_provider_unittest.cc browser/autocomplete/history_url_provider_unittest.cc browser/autocomplete/keyword_provider_unittest.cc browser/bookmarks/bookmark_html_writer_unittest.cc Review URL: http://codereview.chromium.org/39335 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11249 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc11
-rw-r--r--chrome/browser/extensions/user_script_master_unittest.cc4
-rw-r--r--chrome/browser/history/page_usage_data.h10
-rw-r--r--chrome/browser/history/visitsegment_database.cc2
-rw-r--r--chrome/browser/sessions/base_session_service.cc2
-rw-r--r--chrome/browser/sessions/session_backend_unittest.cc16
-rw-r--r--chrome/browser/sessions/session_service_test_helper.cc10
-rw-r--r--chrome/browser/sessions/session_service_test_helper.h6
-rw-r--r--chrome/browser/sessions/session_service_unittest.cc108
-rw-r--r--chrome/browser/sessions/session_types.cc4
-rw-r--r--chrome/browser/sessions/session_types.h7
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc5
-rw-r--r--chrome/test/unit/unit_tests.scons4
13 files changed, 100 insertions, 89 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 923f545..21cffa7 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -118,13 +118,15 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
// Adds "url", "title", and "direction" keys on incoming dictionary, setting
// title as the url as a fallback on empty title.
void SetURLTitleAndDirection(DictionaryValue* dictionary,
- const std::wstring& title,
+ const string16& title,
const GURL& gurl) {
std::wstring wstring_url = UTF8ToWide(gurl.spec());
dictionary->SetString(L"url", wstring_url);
+ std::wstring wstring_title = UTF16ToWide(title);
+
bool using_url_as_the_title = false;
- std::wstring title_to_set(title);
+ std::wstring title_to_set(wstring_title);
if (title_to_set.empty()) {
using_url_as_the_title = true;
title_to_set = wstring_url;
@@ -155,7 +157,7 @@ void SetURLTitleAndDirection(DictionaryValue* dictionary,
if (using_url_as_the_title) {
l10n_util::WrapStringWithLTRFormatting(&title_to_set);
} else {
- if (l10n_util::StringContainsStrongRTLChars(title)) {
+ if (l10n_util::StringContainsStrongRTLChars(wstring_title)) {
l10n_util::WrapStringWithRTLFormatting(&title_to_set);
direction = kRTLHtmlTextDirection;
} else {
@@ -525,7 +527,8 @@ void RecentlyBookmarkedHandler::SendBookmarksToPage() {
for (size_t i = 0; i < recently_bookmarked.size(); ++i) {
BookmarkNode* node = recently_bookmarked[i];
DictionaryValue* entry_value = new DictionaryValue;
- SetURLTitleAndDirection(entry_value, node->GetTitle(), node->GetURL());
+ SetURLTitleAndDirection(entry_value,
+ WideToUTF16(node->GetTitle()), node->GetURL());
list_value.Append(entry_value);
}
dom_ui_->CallJavascriptFunction(L"recentlyBookmarked", list_value);
diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc
index 7e5408c..b9945bd 100644
--- a/chrome/browser/extensions/user_script_master_unittest.cc
+++ b/chrome/browser/extensions/user_script_master_unittest.cc
@@ -98,7 +98,7 @@ TEST_F(UserScriptMasterTest, NewScripts) {
FilePath path = script_dir_.AppendASCII("script.user.js");
const char content[] = "some content";
- int written = file_util::WriteFile(path, content, sizeof(content));
+ size_t written = file_util::WriteFile(path, content, sizeof(content));
ASSERT_EQ(written, sizeof(content));
message_loop_.Run();
@@ -111,7 +111,7 @@ TEST_F(UserScriptMasterTest, ExistingScripts) {
FilePath path = script_dir_.AppendASCII("script.user.js");
const char content[] = "some content";
- int written = file_util::WriteFile(path, content, sizeof(content));
+ size_t written = file_util::WriteFile(path, content, sizeof(content));
ASSERT_EQ(written, sizeof(content));
scoped_refptr<UserScriptMaster> master(
diff --git a/chrome/browser/history/page_usage_data.h b/chrome/browser/history/page_usage_data.h
index b4e62fe..a4cd94f 100644
--- a/chrome/browser/history/page_usage_data.h
+++ b/chrome/browser/history/page_usage_data.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_HISTORY_PAGE_USAGE_DATA_H__
#define CHROME_BROWSER_HISTORY_PAGE_USAGE_DATA_H__
-#include "SkBitmap.h"
-
+#include "base/string16.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_types.h"
#include "googleurl/src/gurl.h"
+#include "skia/include/SkBitmap.h"
/////////////////////////////////////////////////////////////////////////////
//
@@ -52,11 +52,11 @@ class PageUsageData {
return url_;
}
- void SetTitle(const std::wstring& s) {
+ void SetTitle(const string16& s) {
title_ = s;
}
- const std::wstring& GetTitle() const {
+ const string16& GetTitle() const {
return title_;
}
@@ -130,7 +130,7 @@ class PageUsageData {
private:
history::URLID id_;
GURL url_;
- std::wstring title_;
+ string16 title_;
SkBitmap* thumbnail_;
bool thumbnail_set_;
diff --git a/chrome/browser/history/visitsegment_database.cc b/chrome/browser/history/visitsegment_database.cc
index 1687e13..6bab4972 100644
--- a/chrome/browser/history/visitsegment_database.cc
+++ b/chrome/browser/history/visitsegment_database.cc
@@ -317,7 +317,7 @@ void VisitSegmentDatabase::QuerySegmentUsage(
statement2->column_string(0, &url);
statement2->column_wstring(1, &title);
pud->SetURL(GURL(url));
- pud->SetTitle(title);
+ pud->SetTitle(WideToUTF16(title));
}
statement2->reset();
}
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index 8423478..6548aa6 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -186,7 +186,7 @@ bool BaseSessionService::RestoreUpdateTabNavigationCommand(
if (!pickle->ReadInt(&iterator, tab_id) ||
!pickle->ReadInt(&iterator, &(navigation->index_)) ||
!pickle->ReadString(&iterator, &url_spec) ||
- !pickle->ReadWString(&iterator, &(navigation->title_)) ||
+ !pickle->ReadString16(&iterator, &(navigation->title_)) ||
!pickle->ReadString(&iterator, &(navigation->state_)) ||
!pickle->ReadInt(&iterator,
reinterpret_cast<int*>(&(navigation->transition_))))
diff --git a/chrome/browser/sessions/session_backend_unittest.cc b/chrome/browser/sessions/session_backend_unittest.cc
index f26ab45..fb424f2 100644
--- a/chrome/browser/sessions/session_backend_unittest.cc
+++ b/chrome/browser/sessions/session_backend_unittest.cc
@@ -35,12 +35,12 @@ SessionCommand* CreateCommandFromData(const TestData& data) {
class SessionBackendTest : public testing::Test {
protected:
virtual void SetUp() {
- std::wstring b = IntToWString(static_cast<int>(GetTickCount()));
+ std::string b = Int64ToString(base::Time::Now().ToInternalValue());
PathService::Get(base::DIR_TEMP, &path_);
path_ = path_.Append(FILE_PATH_LITERAL("SessionTestDirs"));
file_util::CreateDirectory(path_);
- path_ = path_.Append(b);
+ path_ = path_.AppendASCII(b);
}
virtual void TearDown() {
@@ -72,7 +72,7 @@ TEST_F(SessionBackendTest, SimpleReadWrite) {
backend = new SessionBackend(BaseSessionService::SESSION_RESTORE, path_);
backend->ReadLastSessionCommandsImpl(&commands);
- ASSERT_EQ(1, commands.size());
+ ASSERT_EQ(1U, commands.size());
AssertCommandEqualsData(data, commands[0]);
STLDeleteElements(&commands);
@@ -81,12 +81,12 @@ TEST_F(SessionBackendTest, SimpleReadWrite) {
backend = new SessionBackend(BaseSessionService::SESSION_RESTORE, path_);
backend->ReadLastSessionCommandsImpl(&commands);
- ASSERT_EQ(0, commands.size());
+ ASSERT_EQ(0U, commands.size());
// Make sure we can delete.
backend->DeleteLastSession();
backend->ReadLastSessionCommandsImpl(&commands);
- ASSERT_EQ(0, commands.size());
+ ASSERT_EQ(0U, commands.size());
}
TEST_F(SessionBackendTest, RandomData) {
@@ -106,7 +106,7 @@ TEST_F(SessionBackendTest, RandomData) {
{ 13, "abcdefghijklm" },
};
- for (int i = 0; i < arraysize(data); ++i) {
+ for (size_t i = 0; i < arraysize(data); ++i) {
scoped_refptr<SessionBackend> backend(
new SessionBackend(BaseSessionService::SESSION_RESTORE, path_));
std::vector<SessionCommand*> commands;
@@ -151,7 +151,7 @@ TEST_F(SessionBackendTest, BigData) {
backend = new SessionBackend(BaseSessionService::SESSION_RESTORE, path_);
commands.clear();
backend->ReadLastSessionCommandsImpl(&commands);
- ASSERT_EQ(3, commands.size());
+ ASSERT_EQ(3U, commands.size());
AssertCommandEqualsData(data[0], commands[0]);
AssertCommandEqualsData(data[1], commands[2]);
@@ -176,7 +176,7 @@ TEST_F(SessionBackendTest, EmptyCommand) {
std::vector<SessionCommand*> commands;
backend->ReadLastSessionCommandsImpl(&commands);
- ASSERT_EQ(1, commands.size());
+ ASSERT_EQ(1U, commands.size());
AssertCommandEqualsData(empty_command, commands[0]);
STLDeleteElements(&commands);
}
diff --git a/chrome/browser/sessions/session_service_test_helper.cc b/chrome/browser/sessions/session_service_test_helper.cc
index 401c59c..a8ee464 100644
--- a/chrome/browser/sessions/session_service_test_helper.cc
+++ b/chrome/browser/sessions/session_service_test_helper.cc
@@ -42,7 +42,7 @@ void SessionServiceTestHelper::AssertTabEquals(SessionID& window_id,
SessionID& tab_id,
int visual_index,
int nav_index,
- int nav_count,
+ size_t nav_count,
const SessionTab& session_tab) {
EXPECT_EQ(window_id.id(), session_tab.window_id.id());
EXPECT_EQ(tab_id.id(), session_tab.tab_id.id());
@@ -52,7 +52,7 @@ void SessionServiceTestHelper::AssertTabEquals(SessionID& window_id,
void SessionServiceTestHelper::AssertTabEquals(
int visual_index,
int nav_index,
- int nav_count,
+ size_t nav_count,
const SessionTab& session_tab) {
EXPECT_EQ(visual_index, session_tab.tab_visual_index);
EXPECT_EQ(nav_index, session_tab.current_navigation_index);
@@ -72,9 +72,9 @@ void SessionServiceTestHelper::AssertNavigationEquals(
void SessionServiceTestHelper::AssertSingleWindowWithSingleTab(
const std::vector<SessionWindow*>& windows,
- int nav_count) {
- ASSERT_EQ(1, windows.size());
- EXPECT_EQ(1, windows[0]->tabs.size());
+ size_t nav_count) {
+ ASSERT_EQ(1U, windows.size());
+ EXPECT_EQ(1U, windows[0]->tabs.size());
EXPECT_EQ(nav_count, windows[0]->tabs[0]->navigations.size());
}
diff --git a/chrome/browser/sessions/session_service_test_helper.h b/chrome/browser/sessions/session_service_test_helper.h
index 92a6db6..4eaa229 100644
--- a/chrome/browser/sessions/session_service_test_helper.h
+++ b/chrome/browser/sessions/session_service_test_helper.h
@@ -41,12 +41,12 @@ class SessionServiceTestHelper {
SessionID& tab_id,
int visual_index,
int nav_index,
- int nav_count,
+ size_t nav_count,
const SessionTab& session_tab);
void AssertTabEquals(int visual_index,
int nav_index,
- int nav_count,
+ size_t nav_count,
const SessionTab& session_tab);
void AssertNavigationEquals(const TabNavigation& expected,
@@ -54,7 +54,7 @@ class SessionServiceTestHelper {
void AssertSingleWindowWithSingleTab(
const std::vector<SessionWindow*>& windows,
- int nav_count);
+ size_t nav_count);
void set_service(SessionService* service) { service_ = service; }
SessionService* service() { return service_.get(); }
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index 593fa48..407190d 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -2,11 +2,10 @@
// 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/string_util.h"
#include "base/path_service.h"
+#include "base/string_util.h"
+#include "base/time.h"
#include "chrome/browser/sessions/session_backend.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_test_helper.h"
@@ -23,12 +22,12 @@ class SessionServiceTest : public testing::Test {
protected:
virtual void SetUp() {
- std::wstring b = IntToWString(static_cast<int>(GetTickCount()));
+ std::string b = Int64ToString(base::Time::Now().ToInternalValue());
PathService::Get(base::DIR_TEMP, &path_);
path_ = path_.Append(FILE_PATH_LITERAL("SessionTestDirs"));
file_util::CreateDirectory(path_);
- path_ = path_.Append(b);
+ path_ = path_.AppendASCII(b);
SessionService* session_service = new SessionService(path_);
helper_.set_service(session_service);
@@ -88,7 +87,8 @@ TEST_F(SessionServiceTest, Basic) {
ASSERT_NE(window_id.id(), tab_id.id());
TabNavigation nav1(0, GURL("http://google.com"),
- GURL("http://www.referrer.com"), L"abc", "def",
+ GURL("http://www.referrer.com"),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -97,11 +97,11 @@ TEST_F(SessionServiceTest, Basic) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_TRUE(window_bounds == windows[0]->bounds);
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
ASSERT_EQ(Browser::TYPE_NORMAL, windows[0]->type);
SessionTab* tab = windows[0]->tabs[0];
@@ -116,7 +116,8 @@ TEST_F(SessionServiceTest, PrunePostData1) {
SessionID tab_id;
ASSERT_NE(window_id.id(), tab_id.id());
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
nav1.set_type_mask(TabNavigation::HAS_POST_DATA);
@@ -126,7 +127,7 @@ TEST_F(SessionServiceTest, PrunePostData1) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(0, windows->size());
+ ASSERT_EQ(0U, windows->size());
}
// Creates two navigation entries, one with post data one without. Restores
@@ -136,10 +137,12 @@ TEST_F(SessionServiceTest, PrunePostData2) {
ASSERT_NE(window_id.id(), tab_id.id());
TabNavigation nav1(0, GURL("http://google.com"),
- GURL("http://www.referrer.com"), L"abc", "def",
+ GURL("http://www.referrer.com"),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
nav1.set_type_mask(TabNavigation::HAS_POST_DATA);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abc", "def",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -149,7 +152,7 @@ TEST_F(SessionServiceTest, PrunePostData2) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
SessionTab* tab = windows[0]->tabs[0];
@@ -163,9 +166,11 @@ TEST_F(SessionServiceTest, ClosingTabStaysClosed) {
SessionID tab2_id;
ASSERT_NE(tab_id.id(), tab2_id.id());
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abcd", "defg",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abcd"), "defg",
PageTransition::AUTO_BOOKMARK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -178,10 +183,10 @@ TEST_F(SessionServiceTest, ClosingTabStaysClosed) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
SessionTab* tab = windows[0]->tabs[0];
helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab);
@@ -192,9 +197,11 @@ TEST_F(SessionServiceTest, ClosingTabStaysClosed) {
TEST_F(SessionServiceTest, Pruning) {
SessionID tab_id;
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abcd", "defg",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abcd"), "defg",
PageTransition::AUTO_BOOKMARK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -207,9 +214,9 @@ TEST_F(SessionServiceTest, Pruning) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
SessionTab* tab = windows[0]->tabs[0];
// We left the selected index at 5, then pruned. When rereading the
@@ -226,9 +233,11 @@ TEST_F(SessionServiceTest, TwoWindows) {
SessionID tab1_id;
SessionID tab2_id;
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abcd", "defg",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abcd"), "defg",
PageTransition::AUTO_BOOKMARK);
helper_.PrepareTabInWindow(window_id, tab1_id, 0, true);
@@ -243,11 +252,11 @@ TEST_F(SessionServiceTest, TwoWindows) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(2, windows->size());
+ ASSERT_EQ(2U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(0, windows[1]->selected_tab_index);
- ASSERT_EQ(1, windows[0]->tabs.size());
- ASSERT_EQ(1, windows[1]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[1]->tabs.size());
SessionTab* rt1;
SessionTab* rt2;
@@ -279,7 +288,8 @@ TEST_F(SessionServiceTest, WindowWithNoTabsGetsPruned) {
SessionID tab1_id;
SessionID tab2_id;
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
helper_.PrepareTabInWindow(window_id, tab1_id, 0, true);
@@ -293,9 +303,9 @@ TEST_F(SessionServiceTest, WindowWithNoTabsGetsPruned) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
SessionTab* tab = windows[0]->tabs[0];
@@ -308,9 +318,11 @@ TEST_F(SessionServiceTest, ClosingWindowDoesntCloseTabs) {
SessionID tab2_id;
ASSERT_NE(tab_id.id(), tab2_id.id());
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abcd", "defg",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abcd"), "defg",
PageTransition::AUTO_BOOKMARK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -324,10 +336,10 @@ TEST_F(SessionServiceTest, ClosingWindowDoesntCloseTabs) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
- ASSERT_EQ(2, windows[0]->tabs.size());
+ ASSERT_EQ(2U, windows[0]->tabs.size());
SessionTab* tab = windows[0]->tabs[0];
helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab);
@@ -347,9 +359,11 @@ TEST_F(SessionServiceTest, WindowCloseCommittedAfterNavigate) {
service()->SetWindowType(window2_id, Browser::TYPE_NORMAL);
service()->SetWindowBounds(window2_id, window_bounds, false);
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abcd", "defg",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abcd"), "defg",
PageTransition::AUTO_BOOKMARK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -365,10 +379,10 @@ TEST_F(SessionServiceTest, WindowCloseCommittedAfterNavigate) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
SessionTab* tab = windows[0]->tabs[0];
helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab);
@@ -385,9 +399,11 @@ TEST_F(SessionServiceTest, IgnorePopups) {
service()->SetWindowType(window2_id, Browser::TYPE_POPUP);
service()->SetWindowBounds(window2_id, window_bounds, false);
- TabNavigation nav1(0, GURL("http://google.com"), GURL(), L"abc", "def",
+ TabNavigation nav1(0, GURL("http://google.com"), GURL(),
+ ASCIIToUTF16("abc"), "def",
PageTransition::QUALIFIER_MASK);
- TabNavigation nav2(0, GURL("http://google2.com"), GURL(), L"abcd", "defg",
+ TabNavigation nav2(0, GURL("http://google2.com"), GURL(),
+ ASCIIToUTF16("abcd"), "defg",
PageTransition::AUTO_BOOKMARK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
@@ -399,10 +415,10 @@ TEST_F(SessionServiceTest, IgnorePopups) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
SessionTab* tab = windows[0]->tabs[0];
helper_.AssertTabEquals(window_id, tab_id, 0, 0, 1, *tab);
@@ -419,7 +435,7 @@ TEST_F(SessionServiceTest, PruneFromFront) {
// Add 5 navigations, with the 4th selected.
for (int i = 0; i < 5; ++i) {
TabNavigation nav(0, GURL(base_url + IntToString(i)), GURL(),
- L"a", "b", PageTransition::QUALIFIER_MASK);
+ ASCIIToUTF16("a"), "b", PageTransition::QUALIFIER_MASK);
UpdateNavigation(window_id, tab_id, nav, i, (i == 3));
}
@@ -430,10 +446,10 @@ TEST_F(SessionServiceTest, PruneFromFront) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(1, windows->size());
+ ASSERT_EQ(1U, windows->size());
ASSERT_EQ(0, windows[0]->selected_tab_index);
ASSERT_EQ(window_id.id(), windows[0]->window_id.id());
- ASSERT_EQ(1, windows[0]->tabs.size());
+ ASSERT_EQ(1U, windows[0]->tabs.size());
// We should be left with three navigations, the 2nd selected.
SessionTab* tab = windows[0]->tabs[0];
@@ -454,7 +470,7 @@ TEST_F(SessionServiceTest, PruneToEmpty) {
// Add 5 navigations, with the 4th selected.
for (int i = 0; i < 5; ++i) {
TabNavigation nav(0, GURL(base_url + IntToString(i)), GURL(),
- L"a", "b", PageTransition::QUALIFIER_MASK);
+ ASCIIToUTF16("a"), "b", PageTransition::QUALIFIER_MASK);
UpdateNavigation(window_id, tab_id, nav, i, (i == 3));
}
@@ -465,5 +481,5 @@ TEST_F(SessionServiceTest, PruneToEmpty) {
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
- ASSERT_EQ(0, windows->size());
+ ASSERT_EQ(0U, windows->size());
}
diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc
index 84853b7..06c95d0 100644
--- a/chrome/browser/sessions/session_types.cc
+++ b/chrome/browser/sessions/session_types.cc
@@ -22,7 +22,7 @@ NavigationEntry* TabNavigation::ToNavigationEntry(int page_id) const {
page_id,
real_url,
referrer_,
- WideToUTF16Hack(title_),
+ title_,
// Use a transition type of reload so that we don't incorrectly
// increase the typed count.
PageTransition::RELOAD);
@@ -35,7 +35,7 @@ NavigationEntry* TabNavigation::ToNavigationEntry(int page_id) const {
void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) {
url_ = entry.display_url();
referrer_ = entry.referrer();
- title_ = UTF16ToWideHack(entry.title());
+ title_ = entry.title();
state_ = entry.content_state();
transition_ = entry.transition_type();
type_mask_ = entry.has_post_data() ? TabNavigation::HAS_POST_DATA : 0;
diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h
index 2e80931..986381f 100644
--- a/chrome/browser/sessions/session_types.h
+++ b/chrome/browser/sessions/session_types.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/gfx/rect.h"
+#include "base/string16.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/common/page_transition_types.h"
@@ -38,7 +39,7 @@ class TabNavigation {
TabNavigation(int index,
const GURL& url,
const GURL& referrer,
- const std::wstring& title,
+ const string16& title,
const std::string& state,
PageTransition::Type transition)
: url_(url),
@@ -64,7 +65,7 @@ class TabNavigation {
const GURL& referrer() const { return referrer_; }
// The title of the page.
- const std::wstring& title() const { return title_; }
+ const string16& title() const { return title_; }
// State bits.
const std::string& state() const { return state_; }
@@ -93,7 +94,7 @@ class TabNavigation {
GURL url_;
GURL referrer_;
- std::wstring title_;
+ string16 title_;
std::string state_;
PageTransition::Type transition_;
int type_mask_;
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index d9b2477..969c615 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -515,11 +515,6 @@ InfoBar* LinkInfoBarDelegate::CreateInfoBar() {
return NULL;
}
-bool CanImportURL(const GURL& url) {
- NOTIMPLEMENTED();
- return false;
-}
-
DownloadRequestDialogDelegate* DownloadRequestDialogDelegate::Create(
TabContents* tab,
DownloadRequestManager::TabDownloadState* host) {
diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons
index fba27e0..9b7bdb8 100644
--- a/chrome/test/unit/unit_tests.scons
+++ b/chrome/test/unit/unit_tests.scons
@@ -387,13 +387,9 @@ if not env.Bit('windows'):
# TODO(port): Port these.
input_files.Remove(
'$CHROME_DIR/browser/autocomplete/autocomplete_unittest.cc',
- '$CHROME_DIR/browser/autocomplete/history_contents_provider_unittest.cc',
- '$CHROME_DIR/browser/autocomplete/history_url_provider_unittest.cc',
- '$CHROME_DIR/browser/autocomplete/keyword_provider_unittest.cc',
'$CHROME_DIR/browser/bookmarks/bookmark_context_menu_test.cc',
'$CHROME_DIR/browser/bookmarks/bookmark_drag_data_unittest.cc',
'$CHROME_DIR/browser/bookmarks/bookmark_folder_tree_model_unittest.cc',
- '$CHROME_DIR/browser/bookmarks/bookmark_html_writer_unittest.cc',
'$CHROME_DIR/browser/bookmarks/bookmark_table_model_unittest.cc',
'$CHROME_DIR/browser/bookmarks/bookmark_utils_unittest.cc',
'$CHROME_DIR/browser/browser_commands_unittest.cc',