summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-02 12:18:46 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-02 12:18:46 +0000
commit5b4eb8fc503839d19399c7f9187192b8e0cbf889 (patch)
tree3ff358a5eba47b31a2d90b7ac06bd6bdbadf1956
parentee2efde1d246a99b956e66297e1595f446b35e2a (diff)
downloadchromium_src-5b4eb8fc503839d19399c7f9187192b8e0cbf889.zip
chromium_src-5b4eb8fc503839d19399c7f9187192b8e0cbf889.tar.gz
chromium_src-5b4eb8fc503839d19399c7f9187192b8e0cbf889.tar.bz2
Port some unit tests from chrome/browser/
Makes over 200 tests pass on Linux. Review URL: http://codereview.chromium.org/18758 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9041 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.scons5
-rw-r--r--chrome/browser/browser.vcproj4
-rw-r--r--chrome/browser/history/expire_history_backend_unittest.cc24
-rw-r--r--chrome/browser/history/history_publisher.cc116
-rw-r--r--chrome/browser/history/history_publisher.h14
-rw-r--r--chrome/browser/history/history_publisher_none.cc34
-rw-r--r--chrome/browser/history/history_publisher_win.cc107
-rw-r--r--chrome/browser/history/history_querying_unittest.cc28
-rw-r--r--chrome/browser/history/query_parser_unittest.cc8
-rw-r--r--chrome/browser/history/starred_url_database_unittest.cc22
-rw-r--r--chrome/browser/history/text_database_manager_unittest.cc10
-rw-r--r--chrome/browser/history/url_database_unittest.cc14
-rw-r--r--chrome/test/unit/unit_tests.scons5
-rw-r--r--chrome/tools/profiles/thumbnail-inl.h2
14 files changed, 211 insertions, 182 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index 0dfecdf..c82db3b 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -253,6 +253,8 @@ input_files = ChromeFileList([
'history/history_marshaling.h',
'history/history_notifications.h',
'history/history_publisher.cc',
+ 'history/history_publisher_none.cc',
+ 'history/history_publisher_win.cc',
'history/history_publisher.h',
'history/history_types.cc',
'history/history_types.h',
@@ -721,7 +723,6 @@ if not env.Bit('windows'):
'hang_monitor/hung_plugin_action.cc',
'hang_monitor/hung_window_detector.cc',
'history/history.cc',
- 'history/history_publisher.cc',
'history_tab_ui.cc',
'history_view.cc',
'icon_loader.cc',
@@ -810,6 +811,7 @@ if not env.Bit('windows'):
input_files.Remove(
'browser_main_win.cc',
+ 'history/history_publisher_win.cc',
'importer/firefox_profile_lock_win.cc',
'js_before_unload_handler_win.cc',
'jsmessage_box_handler_win.cc',
@@ -831,6 +833,7 @@ if env.Bit('windows'):
env.TypeLibrary('history/history_indexer.idl')
input_files.Remove(
+ 'history/history_publisher_none.cc',
'importer/firefox_profile_lock_posix.cc',
)
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj
index 80b2f6e..3449e2b 100644
--- a/chrome/browser/browser.vcproj
+++ b/chrome/browser/browser.vcproj
@@ -986,6 +986,10 @@
>
</File>
<File
+ RelativePath=".\history\history_publisher_win.cc"
+ >
+ </File>
+ <File
RelativePath=".\history\history_publisher.h"
>
</File>
diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc
index 8d392a4..0799dbc 100644
--- a/chrome/browser/history/expire_history_backend_unittest.cc
+++ b/chrome/browser/history/expire_history_backend_unittest.cc
@@ -292,7 +292,7 @@ void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) {
// There should be no visits.
VisitVector visits;
main_db_->GetVisitsForURL(row.id(), &visits);
- EXPECT_EQ(0, visits.size());
+ EXPECT_EQ(0U, visits.size());
// Thumbnail should be gone.
EXPECT_FALSE(HasThumbnail(row.id()));
@@ -387,7 +387,7 @@ TEST_F(ExpireHistoryTest, DeleteURLAndFavicon) {
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[2], &visits);
- ASSERT_EQ(1, visits.size());
+ ASSERT_EQ(1U, visits.size());
EXPECT_EQ(1, CountTextMatchesForURL(last_row.url()));
// In this test we also make sure that any pending entries in the text
@@ -447,7 +447,7 @@ TEST_F(ExpireHistoryTest, DeleteURLWithoutFavicon) {
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[1], &visits);
- EXPECT_EQ(2, visits.size());
+ EXPECT_EQ(2U, visits.size());
EXPECT_EQ(1, CountTextMatchesForURL(last_row.url()));
// Delete the URL and its dependencies.
@@ -480,13 +480,13 @@ TEST_F(ExpireHistoryTest, DontDeleteStarredURL) {
// And the favicon should exist.
EXPECT_TRUE(HasFavIcon(url_row.favicon_id()));
- // But there should be no fts.
+ // But there should be no fts.
ASSERT_EQ(0, CountTextMatchesForURL(url_row.url()));
// And no visits.
VisitVector visits;
main_db_->GetVisitsForURL(url_row.id(), &visits);
- ASSERT_EQ(0, visits.size());
+ ASSERT_EQ(0U, visits.size());
// Should still have the thumbnail.
ASSERT_TRUE(HasThumbnail(url_row.id()));
@@ -494,7 +494,7 @@ TEST_F(ExpireHistoryTest, DontDeleteStarredURL) {
// Unstar the URL and delete again.
bookmark_model_.SetURLStarred(url, std::wstring(), false);
expirer_.DeleteURL(url);
-
+
// Now it should be completely deleted.
EnsureURLInfoGone(url_row);
}
@@ -515,7 +515,7 @@ TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarred) {
// database manager are removed.
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[2], &visits);
- ASSERT_EQ(1, visits.size());
+ ASSERT_EQ(1U, visits.size());
text_db_->AddPageURL(url_row2.url(), url_row2.id(), visits[0].visit_id,
visits[0].visit_time);
@@ -531,7 +531,7 @@ TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarred) {
// Verify that the middle URL had its last visit deleted only.
visits.clear();
main_db_->GetVisitsForURL(url_ids[1], &visits);
- EXPECT_EQ(1, visits.size());
+ EXPECT_EQ(1U, visits.size());
EXPECT_EQ(0, CountTextMatchesForURL(url_row1.url()));
// Verify that the middle URL visit time and visit counts were updated.
@@ -631,7 +631,7 @@ TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeUnstarred) {
EXPECT_TRUE(archived_db_->GetRowForURL(url_row1.url(), &archived_row));
VisitVector archived_visits;
archived_db_->GetVisitsForURL(archived_row.id(), &archived_visits);
- EXPECT_EQ(1, archived_visits.size());
+ EXPECT_EQ(1U, archived_visits.size());
}
TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeStarred) {
@@ -659,19 +659,19 @@ TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeStarred) {
EXPECT_FALSE(archived_db_->GetRowForURL(temp_row.url(), NULL));
VisitVector visits;
main_db_->GetVisitsForURL(temp_row.id(), &visits);
- EXPECT_EQ(0, visits.size());
+ EXPECT_EQ(0U, visits.size());
// The second URL should have its first visit deleted and its second visit
// archived. It should be present in both the main DB (because it's starred)
// and the archived DB (for the archived visit).
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row));
main_db_->GetVisitsForURL(temp_row.id(), &visits);
- EXPECT_EQ(0, visits.size());
+ EXPECT_EQ(0U, visits.size());
// Note that the ID is different in the archived DB, so look up by URL.
ASSERT_TRUE(archived_db_->GetRowForURL(temp_row.url(), &temp_row));
archived_db_->GetVisitsForURL(temp_row.id(), &visits);
- ASSERT_EQ(1, visits.size());
+ ASSERT_EQ(1U, visits.size());
EXPECT_TRUE(visit_times[2] == visits[0].visit_time);
// The third URL should be unchanged.
diff --git a/chrome/browser/history/history_publisher.cc b/chrome/browser/history/history_publisher.cc
index 5b4eead..52327c5 100644
--- a/chrome/browser/history/history_publisher.cc
+++ b/chrome/browser/history/history_publisher.cc
@@ -1,91 +1,13 @@
-// Copyright (c) 008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2008-2009 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.
#include "chrome/browser/history/history_publisher.h"
-#if defined(OS_WIN)
-#include <atlsafe.h>
-#include <objbase.h>
-#include <oleauto.h>
-#include <wtypes.h>
-#endif
-
-#include "base/registry.h"
-
namespace history {
-const wchar_t* HistoryPublisher::kRegKeyRegisteredIndexersInfo =
- L"Software\\Google\\Google Chrome\\IndexerPlugins";
const char* HistoryPublisher::kThumbnailImageFormat = "image/jpeg";
-// static
-double HistoryPublisher::TimeToUTCVariantTime(const base::Time& time) {
- double var_time = 0;
-#if defined(OS_WIN)
- if (!time.is_null()) {
- base::Time::Exploded exploded;
- time.UTCExplode(&exploded);
-
- // Create the system time struct representing our exploded time.
- SYSTEMTIME system_time;
- system_time.wYear = exploded.year;
- system_time.wMonth = exploded.month;
- system_time.wDayOfWeek = exploded.day_of_week;
- system_time.wDay = exploded.day_of_month;
- system_time.wHour = exploded.hour;
- system_time.wMinute = exploded.minute;
- system_time.wSecond = exploded.second;
- system_time.wMilliseconds = exploded.millisecond;
- SystemTimeToVariantTime(&system_time, &var_time);
- }
-#endif
-
- return var_time;
-}
-
-HistoryPublisher::HistoryPublisher() {
-#if defined(OS_WIN)
- CoInitialize(NULL);
-#endif
-}
-
-HistoryPublisher::~HistoryPublisher() {
-#if defined(OS_WIN)
- CoUninitialize();
-#endif
-}
-
-bool HistoryPublisher::Init() {
- return ReadRegisteredIndexersFromRegistry();
-}
-
-bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() {
-#if defined(OS_WIN)
- RegistryKeyIterator iter(HKEY_CURRENT_USER, kRegKeyRegisteredIndexersInfo);
- while (iter.Valid()) {
- // The subkey name is the GUID of the Indexer COM object which implements
- // the IChromeHistoryIndexer interface. We shall store that and use it to
- // send historical data to the indexer.
- CLSID clsid;
- CLSIDFromString(static_cast<LPOLESTR>(
- const_cast<TCHAR*>(iter.Name())), &clsid);
- CComPtr<IChromeHistoryIndexer> indexer;
- HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC,
- __uuidof(IChromeHistoryIndexer),
- reinterpret_cast<void**>(&indexer));
- if (SUCCEEDED(hr) && indexer != NULL)
- indexers_.push_back(indexer);
- ++iter;
- }
- return indexers_.size() > 0;
-#else
- // The indexing plublisher is implemented only for Windows platform as of
- // now. Hence returning false for other platforms.
- return false;
-#endif
-}
-
void HistoryPublisher::PublishPageThumbnail(
const std::vector<unsigned char>& thumbnail, const GURL& url,
const base::Time& time) const {
@@ -117,40 +39,4 @@ void HistoryPublisher::PublishPageContent(const base::Time& time,
PublishDataToIndexers(page_data);
}
-void HistoryPublisher::PublishDataToIndexers(const PageData& page_data)
- const {
-#if defined(OS_WIN)
- double var_time = TimeToUTCVariantTime(page_data.time);
-
- CComSafeArray<unsigned char> thumbnail_arr;
- if (page_data.thumbnail) {
- for(size_t i = 0; i < page_data.thumbnail->size(); ++i)
- thumbnail_arr.Add((*page_data.thumbnail)[i]);
- }
-
- // Send data to registered indexers.
- for(size_t i = 0; i < indexers_.size(); ++i) {
- indexers_[i]->SendPageData(
- CComVariant(var_time, VT_DATE),
- CComBSTR(page_data.url.spec().c_str()),
- CComBSTR(page_data.html),
- CComBSTR(page_data.title),
- CComBSTR(page_data.thumbnail_format),
- CComVariant(thumbnail_arr.m_psa));
- }
-#endif
-}
-
-void HistoryPublisher::DeleteUserHistoryBetween(const base::Time& begin_time,
- const base::Time& end_time) const {
-#if defined(OS_WIN)
- double var_begin_time = TimeToUTCVariantTime(begin_time);
- double var_end_time = TimeToUTCVariantTime(end_time);
- for(size_t i = 0; i < indexers_.size(); ++i) {
- indexers_[i]->DeleteUserHistoryBetween(CComVariant(var_begin_time, VT_DATE),
- CComVariant(var_end_time, VT_DATE));
- }
-#endif
-}
-
} // namespace history
diff --git a/chrome/browser/history/history_publisher.h b/chrome/browser/history/history_publisher.h
index 7c199ac..71005e5 100644
--- a/chrome/browser/history/history_publisher.h
+++ b/chrome/browser/history/history_publisher.h
@@ -48,27 +48,27 @@ class HistoryPublisher {
const char* thumbnail_format;
const std::vector<unsigned char>* thumbnail;
};
- void PublishDataToIndexers(const PageData& page_data) const;
- // Converts time represented by the Time class object to variant time in UTC.
- // Returns '0' if the time object is NULL.
- static double TimeToUTCVariantTime(const base::Time& time);
+ void PublishDataToIndexers(const PageData& page_data) const;
+#if defined(OS_WIN)
// Initializes the indexer_list_ with the list of indexers that registered
// with us to index history. Returns true if there are any registered.
bool ReadRegisteredIndexersFromRegistry();
- private:
-#if defined(OS_WIN)
+ // Converts time represented by the Time class object to variant time in UTC.
+ // Returns '0' if the time object is NULL.
+ static double TimeToUTCVariantTime(const base::Time& time);
+
typedef std::vector<CComPtr<IChromeHistoryIndexer> > IndexerList;
// The list of indexers registered to receive history data from us.
IndexerList indexers_;
-#endif
// The Registry key under HKCU where the indexers need to register their
// CLSID.
static const wchar_t* kRegKeyRegisteredIndexersInfo;
+#endif
// The format of the thumbnail we pass to indexers.
static const char* kThumbnailImageFormat;
diff --git a/chrome/browser/history/history_publisher_none.cc b/chrome/browser/history/history_publisher_none.cc
new file mode 100644
index 0000000..2a164bf
--- /dev/null
+++ b/chrome/browser/history/history_publisher_none.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2009 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.
+
+// A stub implementation of HistoryPublisher used to provide needed symbols.
+// For now there is no equivalent of this functionality on systems other than
+// Windows.
+
+#include "chrome/browser/history/history_publisher.h"
+
+#include "base/time.h"
+
+namespace history {
+
+HistoryPublisher::HistoryPublisher() {
+}
+
+HistoryPublisher::~HistoryPublisher() {
+}
+
+bool HistoryPublisher::Init() {
+ return false;
+}
+
+void HistoryPublisher::PublishDataToIndexers(const PageData& page_data)
+ const {
+}
+
+void HistoryPublisher::DeleteUserHistoryBetween(const base::Time& begin_time,
+ const base::Time& end_time)
+ const {
+}
+
+} // namespace history
diff --git a/chrome/browser/history/history_publisher_win.cc b/chrome/browser/history/history_publisher_win.cc
new file mode 100644
index 0000000..72c0f1d
--- /dev/null
+++ b/chrome/browser/history/history_publisher_win.cc
@@ -0,0 +1,107 @@
+// Copyright (c) 2008-2009 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.
+
+#include "chrome/browser/history/history_publisher.h"
+
+#include <atlsafe.h>
+#include <objbase.h>
+#include <oleauto.h>
+#include <wtypes.h>
+
+#include "base/registry.h"
+
+namespace history {
+
+const wchar_t* HistoryPublisher::kRegKeyRegisteredIndexersInfo =
+ L"Software\\Google\\Google Chrome\\IndexerPlugins";
+
+// static
+double HistoryPublisher::TimeToUTCVariantTime(const base::Time& time) {
+ double var_time = 0;
+ if (!time.is_null()) {
+ base::Time::Exploded exploded;
+ time.UTCExplode(&exploded);
+
+ // Create the system time struct representing our exploded time.
+ SYSTEMTIME system_time;
+ system_time.wYear = exploded.year;
+ system_time.wMonth = exploded.month;
+ system_time.wDayOfWeek = exploded.day_of_week;
+ system_time.wDay = exploded.day_of_month;
+ system_time.wHour = exploded.hour;
+ system_time.wMinute = exploded.minute;
+ system_time.wSecond = exploded.second;
+ system_time.wMilliseconds = exploded.millisecond;
+ SystemTimeToVariantTime(&system_time, &var_time);
+ }
+
+ return var_time;
+}
+
+HistoryPublisher::HistoryPublisher() {
+ CoInitialize(NULL);
+}
+
+HistoryPublisher::~HistoryPublisher() {
+ CoUninitialize();
+}
+
+bool HistoryPublisher::Init() {
+ return ReadRegisteredIndexersFromRegistry();
+}
+
+bool HistoryPublisher::ReadRegisteredIndexersFromRegistry() {
+ RegistryKeyIterator iter(HKEY_CURRENT_USER, kRegKeyRegisteredIndexersInfo);
+ while (iter.Valid()) {
+ // The subkey name is the GUID of the Indexer COM object which implements
+ // the IChromeHistoryIndexer interface. We shall store that and use it to
+ // send historical data to the indexer.
+ CLSID clsid;
+ CLSIDFromString(static_cast<LPOLESTR>(
+ const_cast<TCHAR*>(iter.Name())), &clsid);
+ CComPtr<IChromeHistoryIndexer> indexer;
+ HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC,
+ __uuidof(IChromeHistoryIndexer),
+ reinterpret_cast<void**>(&indexer));
+ if (SUCCEEDED(hr) && indexer != NULL)
+ indexers_.push_back(indexer);
+ ++iter;
+ }
+ return indexers_.size() > 0;
+}
+
+void HistoryPublisher::PublishDataToIndexers(const PageData& page_data)
+ const {
+ double var_time = TimeToUTCVariantTime(page_data.time);
+
+ CComSafeArray<unsigned char> thumbnail_arr;
+ if (page_data.thumbnail) {
+ for(size_t i = 0; i < page_data.thumbnail->size(); ++i)
+ thumbnail_arr.Add((*page_data.thumbnail)[i]);
+ }
+
+ // Send data to registered indexers.
+ for(size_t i = 0; i < indexers_.size(); ++i) {
+ indexers_[i]->SendPageData(
+ CComVariant(var_time, VT_DATE),
+ CComBSTR(page_data.url.spec().c_str()),
+ CComBSTR(page_data.html),
+ CComBSTR(page_data.title),
+ CComBSTR(page_data.thumbnail_format),
+ CComVariant(thumbnail_arr.m_psa));
+ }
+}
+
+void HistoryPublisher::DeleteUserHistoryBetween(const base::Time& begin_time,
+ const base::Time& end_time)
+ const {
+ double var_begin_time = TimeToUTCVariantTime(begin_time);
+ double var_end_time = TimeToUTCVariantTime(end_time);
+ for(size_t i = 0; i < indexers_.size(); ++i) {
+ indexers_[i]->DeleteUserHistoryBetween(CComVariant(var_begin_time, VT_DATE),
+ CComVariant(var_end_time, VT_DATE));
+ }
+}
+
+} // namespace history
diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc
index 153ee5c1..488fd97 100644
--- a/chrome/browser/history/history_querying_unittest.cc
+++ b/chrome/browser/history/history_querying_unittest.cc
@@ -96,7 +96,7 @@ class HistoryQueryTest : public testing::Test {
// Fill the test data.
Time now = Time::Now().LocalMidnight();
- for (int i = 0; i < arraysize(test_entries); i++) {
+ for (size_t i = 0; i < arraysize(test_entries); i++) {
test_entries[i].time =
now - (test_entries[i].days_ago * TimeDelta::FromDays(1));
@@ -128,7 +128,7 @@ class HistoryQueryTest : public testing::Test {
}
MessageLoop message_loop_;
-
+
std::wstring history_dir_;
CancelableRequestConsumer consumer_;
@@ -149,7 +149,7 @@ TEST_F(HistoryQueryTest, Basic) {
// First query for all of them to make sure they are there and in
// chronological order, most recent first.
QueryHistory(std::wstring(), options, &results);
- ASSERT_EQ(5, results.size());
+ ASSERT_EQ(5U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 4));
EXPECT_TRUE(NthResultIs(results, 1, 2));
EXPECT_TRUE(NthResultIs(results, 2, 3));
@@ -161,7 +161,7 @@ TEST_F(HistoryQueryTest, Basic) {
options.begin_time = test_entries[3].time;
options.end_time = test_entries[2].time;
QueryHistory(std::wstring(), options, &results);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 3));
}
@@ -176,7 +176,7 @@ TEST_F(HistoryQueryTest, BasicCount) {
// get the N most recent entries.
options.max_count = 2;
QueryHistory(std::wstring(), options, &results);
- EXPECT_EQ(2, results.size());
+ EXPECT_EQ(2U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 4));
EXPECT_TRUE(NthResultIs(results, 1, 2));
}
@@ -192,7 +192,7 @@ TEST_F(HistoryQueryTest, BasicDupes) {
// only test collapsing.
options.most_recent_visit_only = true;
QueryHistory(std::wstring(), options, &results);
- EXPECT_EQ(4, results.size());
+ EXPECT_EQ(4U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 4));
EXPECT_TRUE(NthResultIs(results, 1, 2));
EXPECT_TRUE(NthResultIs(results, 2, 3));
@@ -211,14 +211,14 @@ TEST_F(HistoryQueryTest, FTS) {
// this query will return the starred item twice since we requested all
// starred entries and no de-duping.
QueryHistory(std::wstring(L"some"), options, &results);
- EXPECT_EQ(3, results.size());
+ EXPECT_EQ(3U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 2));
EXPECT_TRUE(NthResultIs(results, 1, 3));
EXPECT_TRUE(NthResultIs(results, 2, 1));
// Do a query that should only match one of them.
QueryHistory(std::wstring(L"PAGETWO"), options, &results);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 3));
// Next query a time range. The beginning should be inclusive, the ending
@@ -226,7 +226,7 @@ TEST_F(HistoryQueryTest, FTS) {
options.begin_time = test_entries[1].time;
options.end_time = test_entries[3].time;
QueryHistory(std::wstring(L"some"), options, &results);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 1));
}
@@ -240,7 +240,7 @@ TEST_F(HistoryQueryTest, FTSTitle) {
// Query all time but with a limit on the number of entries. We should
// get the N most recent entries.
QueryHistory(std::wstring(L"title"), options, &results);
- EXPECT_EQ(3, results.size());
+ EXPECT_EQ(3U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 2));
EXPECT_TRUE(NthResultIs(results, 1, 3));
EXPECT_TRUE(NthResultIs(results, 2, 1));
@@ -256,7 +256,7 @@ TEST_F(HistoryQueryTest, FTSPrefix) {
// Query with a prefix search. Should return matches for "PAGETWO" and
// "PAGETHREE".
QueryHistory(std::wstring(L"PAGET"), options, &results);
- EXPECT_EQ(2, results.size());
+ EXPECT_EQ(2U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 2));
EXPECT_TRUE(NthResultIs(results, 1, 3));
}
@@ -272,7 +272,7 @@ TEST_F(HistoryQueryTest, FTSCount) {
// get the N most recent entries.
options.max_count = 2;
QueryHistory(std::wstring(L"some"), options, &results);
- EXPECT_EQ(2, results.size());
+ EXPECT_EQ(2U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 2));
EXPECT_TRUE(NthResultIs(results, 1, 3));
@@ -281,7 +281,7 @@ TEST_F(HistoryQueryTest, FTSCount) {
// page max restriction.
options.max_count = 1;
QueryHistory(std::wstring(L"FOO"), options, &results);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
EXPECT_TRUE(NthResultIs(results, 0, 3));
}
@@ -312,7 +312,7 @@ TEST_F(HistoryQueryTest, FTSArchived) {
// database and not the most current title (since otherwise highlighting in
// the title might be wrong).
QueryHistory(std::wstring(L"archived"), options, &results);
- ASSERT_EQ(1, results.size());
+ ASSERT_EQ(1U, results.size());
EXPECT_TRUE(row1.url() == results[0].url());
EXPECT_TRUE(row1.title() == results[0].title());
}
diff --git a/chrome/browser/history/query_parser_unittest.cc b/chrome/browser/history/query_parser_unittest.cc
index 3f75989..25d4f4e 100644
--- a/chrome/browser/history/query_parser_unittest.cc
+++ b/chrome/browser/history/query_parser_unittest.cc
@@ -88,10 +88,10 @@ TEST_F(QueryParserTest, ParseQueryNodesAndMatch) {
const std::wstring query;
const std::wstring text;
const bool matches;
- const int m1_start;
- const int m1_end;
- const int m2_start;
- const int m2_end;
+ const size_t m1_start;
+ const size_t m1_end;
+ const size_t m2_start;
+ const size_t m2_end;
} data[] = {
{ L"foo foo", L"foo", true, 0, 3, 0, 0 },
{ L"foo fooey", L"fooey", true, 0, 5, 0, 0 },
diff --git a/chrome/browser/history/starred_url_database_unittest.cc b/chrome/browser/history/starred_url_database_unittest.cc
index e1c8203..0b3281c 100644
--- a/chrome/browser/history/starred_url_database_unittest.cc
+++ b/chrome/browser/history/starred_url_database_unittest.cc
@@ -77,7 +77,7 @@ class StarredURLDatabaseTest : public testing::Test,
FILE_PATH_LITERAL("History_with_empty_starred"));
file_util::CopyFile(old_history_path, db_file_);
- EXPECT_EQ(SQLITE_OK,
+ EXPECT_EQ(SQLITE_OK,
sqlite3_open(WideToUTF8(db_file_.ToWStringHack()).c_str(), &db_));
statement_cache_ = new SqliteStatementCache(db_);
@@ -108,7 +108,7 @@ class StarredURLDatabaseTest : public testing::Test,
//-----------------------------------------------------------------------------
TEST_F(StarredURLDatabaseTest, FixOrphanedGroup) {
- const size_t initial_count = GetStarredEntryCount();
+ const int initial_count = GetStarredEntryCount();
// Create a group that isn't parented to the other/bookmark folders.
StarredEntry g_entry;
@@ -130,19 +130,19 @@ TEST_F(StarredURLDatabaseTest, FixOrphanedGroup) {
}
TEST_F(StarredURLDatabaseTest, FixOrphanedBookmarks) {
- const size_t initial_count = GetStarredEntryCount();
+ const int initial_count = GetStarredEntryCount();
// Create two bookmarks that aren't in a random folder no on the bookmark bar.
StarredEntry entry1;
entry1.parent_group_id = 100;
entry1.visual_order = 10;
- entry1.url = GURL(L"http://google.com/1");
+ entry1.url = GURL("http://google.com/1");
CreateStarredEntry(&entry1);
StarredEntry entry2;
entry2.parent_group_id = 101;
entry2.visual_order = 20;
- entry2.url = GURL(L"http://google.com/2");
+ entry2.url = GURL("http://google.com/2");
CreateStarredEntry(&entry2);
ASSERT_TRUE(EnsureStarredIntegrity());
@@ -162,7 +162,7 @@ TEST_F(StarredURLDatabaseTest, FixOrphanedBookmarks) {
}
TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth0) {
- const size_t initial_count = GetStarredEntryCount();
+ const int initial_count = GetStarredEntryCount();
// Create a group that is parented to itself.
StarredEntry entry1;
@@ -184,7 +184,7 @@ TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth0) {
}
TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth1) {
- const size_t initial_count = GetStarredEntryCount();
+ const int initial_count = GetStarredEntryCount();
StarredEntry entry1;
entry1.group_id = 100;
@@ -216,18 +216,18 @@ TEST_F(StarredURLDatabaseTest, FixGroupCycleDepth1) {
}
TEST_F(StarredURLDatabaseTest, FixVisualOrder) {
- const size_t initial_count = GetStarredEntryCount();
+ const int initial_count = GetStarredEntryCount();
// Star two urls.
StarredEntry entry1;
- entry1.url = GURL(L"http://google.com/1");
+ entry1.url = GURL("http://google.com/1");
entry1.parent_group_id = HistoryService::kBookmarkBarID;
entry1.visual_order = 5;
CreateStarredEntry(&entry1);
// Add url2 and star it.
StarredEntry entry2;
- entry2.url = GURL(L"http://google.com/2");
+ entry2.url = GURL("http://google.com/2");
entry2.parent_group_id = HistoryService::kBookmarkBarID;
entry2.visual_order = 10;
CreateStarredEntry(&entry2);
@@ -248,7 +248,7 @@ TEST_F(StarredURLDatabaseTest, FixVisualOrder) {
}
TEST_F(StarredURLDatabaseTest, FixDuplicateGroupIDs) {
- const size_t initial_count = GetStarredEntryCount();
+ const int initial_count = GetStarredEntryCount();
// Create two groups with the same group id.
StarredEntry entry1;
diff --git a/chrome/browser/history/text_database_manager_unittest.cc b/chrome/browser/history/text_database_manager_unittest.cc
index 8d9c10b..14d2b90 100644
--- a/chrome/browser/history/text_database_manager_unittest.cc
+++ b/chrome/browser/history/text_database_manager_unittest.cc
@@ -49,7 +49,7 @@ class TextDatabaseManagerTest : public testing::Test {
void TearDown() {
file_util::Delete(dir_, true);
}
-
+
MessageLoop message_loop_;
// Directory containing the databases.
@@ -340,21 +340,21 @@ TEST_F(TextDatabaseManagerTest, PartialComplete) {
QueryOptions options;
std::vector<TextDatabase::Match> results;
manager.GetTextMatches(L"unique", options, &results, &first_time_searched);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
manager.GetTextMatches(L"chocolate", options, &results, &first_time_searched);
- EXPECT_EQ(0, results.size());
+ EXPECT_EQ(0U, results.size());
// Now add the body, which should be queryable.
manager.AddPageContents(url, L"Very awesome body");
manager.GetTextMatches(L"awesome", options, &results, &first_time_searched);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
// Adding the body will actually copy the title from the URL table rather
// than the previously indexed row (we made them not match above). This isn't
// necessarily what we want, but it's how it's implemented, and we don't want
// to regress it.
manager.GetTextMatches(L"chocolate", options, &results, &first_time_searched);
- EXPECT_EQ(1, results.size());
+ EXPECT_EQ(1U, results.size());
}
// Tests that changes get properly committed to disk.
diff --git a/chrome/browser/history/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc
index 2159e45..9520fa7 100644
--- a/chrome/browser/history/url_database_unittest.cc
+++ b/chrome/browser/history/url_database_unittest.cc
@@ -75,7 +75,7 @@ class URLDatabaseTest : public testing::Test,
// Test add and query for the URL table in the HistoryDatabase
TEST_F(URLDatabaseTest, AddURL) {
// first, add two URLs
- const GURL url1(L"http://www.google.com/");
+ const GURL url1("http://www.google.com/");
URLRow url_info1(url1);
url_info1.set_title(L"Google");
url_info1.set_visit_count(4);
@@ -84,7 +84,7 @@ TEST_F(URLDatabaseTest, AddURL) {
url_info1.set_hidden(false);
EXPECT_TRUE(AddURL(url_info1));
- const GURL url2(L"http://mail.google.com/");
+ const GURL url2("http://mail.google.com/");
URLRow url_info2(url2);
url_info2.set_title(L"Google Mail");
url_info2.set_visit_count(3);
@@ -129,7 +129,7 @@ TEST_F(URLDatabaseTest, AddURL) {
// Tests adding, querying and deleting keyword visits.
TEST_F(URLDatabaseTest, KeywordSearchTermVisit) {
- const GURL url1(L"http://www.google.com/");
+ const GURL url1("http://www.google.com/");
URLRow url_info1(url1);
url_info1.set_title(L"Google");
url_info1.set_visit_count(4);
@@ -145,7 +145,7 @@ TEST_F(URLDatabaseTest, KeywordSearchTermVisit) {
// Make sure we get it back.
std::vector<KeywordSearchTermVisit> matches;
GetMostRecentKeywordSearchTerms(1, L"visit", 10, &matches);
- ASSERT_EQ(1, matches.size());
+ ASSERT_EQ(1U, matches.size());
ASSERT_EQ(L"visit", matches[0].term);
// Delete the keyword visit.
@@ -154,12 +154,12 @@ TEST_F(URLDatabaseTest, KeywordSearchTermVisit) {
// Make sure we don't get it back when querying.
matches.clear();
GetMostRecentKeywordSearchTerms(1, L"visit", 10, &matches);
- ASSERT_EQ(0, matches.size());
+ ASSERT_EQ(0U, matches.size());
}
// Make sure deleting a URL also deletes a keyword visit.
TEST_F(URLDatabaseTest, DeleteURLDeletesKeywordSearchTermVisit) {
- const GURL url1(L"http://www.google.com/");
+ const GURL url1("http://www.google.com/");
URLRow url_info1(url1);
url_info1.set_title(L"Google");
url_info1.set_visit_count(4);
@@ -178,7 +178,7 @@ TEST_F(URLDatabaseTest, DeleteURLDeletesKeywordSearchTermVisit) {
// Make sure the keyword visit was deleted.
std::vector<KeywordSearchTermVisit> matches;
GetMostRecentKeywordSearchTerms(1, L"visit", 10, &matches);
- ASSERT_EQ(0, matches.size());
+ ASSERT_EQ(0U, matches.size());
}
} // namespace history
diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons
index 0c720fa..b8833a8 100644
--- a/chrome/test/unit/unit_tests.scons
+++ b/chrome/test/unit/unit_tests.scons
@@ -384,18 +384,13 @@ if not env.Bit('windows'):
'$CHROME_DIR/browser/download/download_manager_unittest.cc',
'$CHROME_DIR/browser/download/download_request_manager_unittest.cc',
'$CHROME_DIR/browser/download/save_package_unittest.cc',
- '$CHROME_DIR/browser/extensions/extension_protocols_unittest.cc',
'$CHROME_DIR/browser/extensions/user_script_master_unittest.cc',
'$CHROME_DIR/browser/google_url_tracker_unittest.cc',
'$CHROME_DIR/browser/history/expire_history_backend_unittest.cc',
'$CHROME_DIR/browser/history/history_backend_unittest.cc',
'$CHROME_DIR/browser/history/history_querying_unittest.cc',
'$CHROME_DIR/browser/history/history_unittest.cc',
- '$CHROME_DIR/browser/history/query_parser_unittest.cc',
'$CHROME_DIR/browser/history/starred_url_database_unittest.cc',
- '$CHROME_DIR/browser/history/text_database_manager_unittest.cc',
- '$CHROME_DIR/browser/history/thumbnail_database_unittest.cc',
- '$CHROME_DIR/browser/history/url_database_unittest.cc',
'$CHROME_DIR/browser/importer/firefox_importer_unittest.cc',
'$CHROME_DIR/browser/importer/importer_unittest.cc',
'$CHROME_DIR/browser/login_prompt_unittest.cc',
diff --git a/chrome/tools/profiles/thumbnail-inl.h b/chrome/tools/profiles/thumbnail-inl.h
index 18ec4a8..7f3fba3 100644
--- a/chrome/tools/profiles/thumbnail-inl.h
+++ b/chrome/tools/profiles/thumbnail-inl.h
@@ -804,4 +804,4 @@ const unsigned char kWeewarThumbnail[] =
"\xb2\x77\x95\x9f\x9d\xc4\xfe\xf4\x00\x3e\xee\x3a\xf7\xae\x96\xc3\xce"
"\x16\x70\x8b\x89\xa3\x9e\xe0\x28\x12\x49\x12\xed\x56\x6e\xe4\x0c\x9c"
"\x7e\x74\x51\x57\x3a\x8e\x69\x26\x97\xc9\x24\x44\x60\xa2\xef\x77\xf7"
-"\x95\x67\x19\x99\xf9\xc7\x3d\x86\x68\xa2\x8a\xe5\x36\x3f\xff\xd9"; \ No newline at end of file
+"\x95\x67\x19\x99\xf9\xc7\x3d\x86\x68\xa2\x8a\xe5\x36\x3f\xff\xd9";