summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sessions
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/browser/sessions
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/browser/sessions')
-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
7 files changed, 85 insertions, 68 deletions
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_;