summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-17 18:16:01 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-17 18:16:01 +0000
commit954bc8a57743da5092b218285b4b8f14239235dd (patch)
tree32976cb1f0b7a534b8d4f44fec2e91dd146c1d74 /chrome
parent22514d70ddb3ce5a3eb99cd022f909d5d7298793 (diff)
downloadchromium_src-954bc8a57743da5092b218285b4b8f14239235dd.zip
chromium_src-954bc8a57743da5092b218285b4b8f14239235dd.tar.gz
chromium_src-954bc8a57743da5092b218285b4b8f14239235dd.tar.bz2
Include chrome SConscript.unit_tests in Linux build.
BUG=2335 Original patch by phajdan.jr@gmail.com in http://codereview.chromium.org/2891 R=mark,sgk Review URL: http://codereview.chromium.org/2939 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/SConscript8
-rw-r--r--chrome/SConscript.unit_tests351
-rw-r--r--chrome/browser/net/dns_host_info_unittest.cc20
-rw-r--r--chrome/browser/safe_browsing/chunk_range_unittest.cc20
-rw-r--r--chrome/browser/safe_browsing/protocol_parser_unittest.cc64
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_util_unittest.cc10
-rw-r--r--chrome/test/unit/run_all_unittests.cc12
7 files changed, 262 insertions, 223 deletions
diff --git a/chrome/SConscript b/chrome/SConscript
index 185b186..282e6c2 100644
--- a/chrome/SConscript
+++ b/chrome/SConscript
@@ -414,15 +414,17 @@ if env_flat['PLATFORM'] == 'win32':
CPPPATH=['..'] + env['CPPPATH'])
test_sconscript_files = [
- 'SConscript.automated_ui_tests',
'SConscript.unit_tests',
- 'SConscript.ui_tests',
]
# TODO(port)
if env['PLATFORM'] == 'win32':
- env.SConscript(test_sconscript_files, exports=['env_test'])
+ test_sconscript_files.extend([
+ 'SConscript.automated_ui_tests',
+ 'SConscript.ui_tests',
+ ])
+env.SConscript(test_sconscript_files, exports=['env_test'])
sconscript_files = [
'browser/SConscript',
diff --git a/chrome/SConscript.unit_tests b/chrome/SConscript.unit_tests
index 8cba2ef..f5fd0d0 100644
--- a/chrome/SConscript.unit_tests
+++ b/chrome/SConscript.unit_tests
@@ -47,173 +47,204 @@ env_test.Prepend(
'v8',
'zlib',
- 'activex_shim',
'WTF',
'V8Bindings',
- 'WebCore',
'default_plugin',
'Glue',
'JavaScriptCore_pcre',
- 'Port',
],
)
-env_test.Prepend(
- LINKFLAGS = [
- '/INCREMENTAL',
-
- '/safeseh',
- '/dynamicbase',
- '/ignore:4199',
- '/nxcompat',
-
- '/MANIFEST',
- '/DELAYLOAD:"ws2_32.dll"',
- '/DELAYLOAD:"dwmapi.dll"',
- '/DELAYLOAD:"uxtheme.dll"',
-
- '/DEBUG',
- '/MACHINE:X86',
- '/FIXED:No',
- ],
- LIBS = [
- 'winmm.lib',
- 'rpcrt4.lib',
- 'oleacc.lib',
- 'comsupp.lib',
- ],
-)
+if env_test['PLATFORM'] == 'win32':
+ # TODO(port): Port or mark as Windows-specific.
+ env_test.Prepend(
+ LIBS = [
+ 'WebCore',
+ 'Port',
+ ],
+ )
+
+if env_test['PLATFORM'] == 'win32':
+ env_test.Prepend(
+ LINKFLAGS = [
+ '/INCREMENTAL',
+
+ '/safeseh',
+ '/dynamicbase',
+ '/ignore:4199',
+ '/nxcompat',
+
+ '/MANIFEST',
+ '/DELAYLOAD:"ws2_32.dll"',
+ '/DELAYLOAD:"dwmapi.dll"',
+ '/DELAYLOAD:"uxtheme.dll"',
+
+ '/DEBUG',
+ '/MACHINE:X86',
+ '/FIXED:No',
+ ],
+ LIBS = [
+ 'activex_shim',
+
+ 'winmm.lib',
+ 'rpcrt4.lib',
+ 'oleacc.lib',
+ 'comsupp.lib',
+ ],
+ )
+
+ libs = [
+ 'snapshotv8.lib',
+
+ 'browser/browser.lib',
+ 'browser/views/browser_views.lib',
+ 'browser/debugger/debugger.lib',
+ 'common/common.lib',
+ 'installer/util/util.lib',
+ 'libjscre.lib',
+ 'plugin/plugin.lib',
+ 'renderer/renderer.lib',
+ 'test/chrome_plugin/test_chrome_plugin.lib',
+ 'third_party/hunspell/hunspell.lib',
+ 'third_party/sqlite/sqlite.lib',
+ 'views/views.lib',
+ ]
+
+unit_test_files = []
+
+if env_test['PLATFORM'] in ('posix', 'win32'):
+ # TODO(port): Port to Mac.
+ unit_test_files.extend([
+ 'browser/net/dns_host_info_unittest.cc',
+ 'browser/safe_browsing/chunk_range_unittest.cc',
+ 'browser/safe_browsing/protocol_parser_unittest.cc',
+ 'browser/safe_browsing/safe_browsing_util_unittest.cc',
+ 'test/unit/run_all_unittests.cc',
+ ])
+
+ env_test.Prepend(
+ LIBS = [
+ 'browser',
+ ],
+ )
+
+if env_test['PLATFORM'] == 'win32':
+ # TODO(port): Port these.
+ unit_test_files.extend([
+ 'browser/autocomplete/autocomplete_unittest.cc',
+ 'browser/autocomplete/history_contents_provider_unittest.cc',
+ 'browser/autocomplete/history_url_provider_unittest.cc',
+ 'browser/autocomplete/keyword_provider_unittest.cc',
+ 'browser/back_forward_menu_model_unittest.cc',
+ 'browser/bookmark_bar_context_menu_controller_test.cc',
+ 'browser/bookmarks/bookmark_bar_unittest.cc',
+ 'browser/bookmarks/bookmark_drag_data_unittest.cc',
+ 'browser/cache_manager_host_unittest.cc',
+ 'browser/chrome_thread_unittest.cc',
+ 'browser/controller_unittest.cc',
+ 'browser/download_manager_unittest.cc',
+ 'browser/encryptor_unittest.cc',
+ 'browser/firefox_importer_unittest.cc',
+ 'browser/google_url_tracker_unittest.cc',
+ 'browser/history/expire_history_backend_unittest.cc',
+ 'browser/history/history_backend_unittest.cc',
+ 'browser/history/history_querying_unittest.cc',
+ 'browser/history/history_types_unittest.cc',
+ 'browser/history/history_unittest.cc',
+ 'browser/history/query_parser_unittest.cc',
+ 'browser/history/snippet_unittest.cc',
+ 'browser/history/starred_url_database_unittest.cc',
+ 'browser/history/text_database_manager_unittest.cc',
+ 'browser/history/text_database_unittest.cc',
+ 'browser/history/thumbnail_database_unittest.cc',
+ 'browser/history/url_database_unittest.cc',
+ 'browser/history/visit_database_unittest.cc',
+ 'browser/history/visit_tracker_unittest.cc',
+ 'browser/importer_unittest.cc',
+ 'browser/metrics_log_unittest.cc',
+ 'browser/metrics_response_unittest.cc',
+ 'browser/navigation_controller_unittest.cc',
+ 'browser/net/dns_master_unittest.cc',
+ 'browser/password_form_manager_unittest.cc',
+ 'browser/printing/page_number_unittest.cc',
+ 'browser/printing/page_overlays_unittest.cc',
+ 'browser/printing/page_range_unittest.cc',
+ 'browser/printing/page_setup_unittest.cc',
+ 'browser/printing/units_unittest.cc',
+ 'browser/printing/win_printing_context_unittest.cc',
+ 'browser/profile_manager_unittest.cc',
+ 'browser/renderer_security_policy_unittest.cc',
+ 'browser/resource_dispatcher_host_unittest.cc',
+ 'browser/rlz/rlz_unittest.cc',
+ 'browser/safe_browsing/bloom_filter_unittest.cc',
+ 'browser/safe_browsing/protocol_manager_unittest.cc',
+ 'browser/safe_browsing/safe_browsing_database_unittest.cc',
+ 'browser/save_package_unittest.cc',
+ 'browser/session_backend_unittest.cc',
+ 'browser/session_service_test_helper.cc',
+ 'browser/session_service_unittest.cc',
+ 'browser/site_instance_unittest.cc',
+ 'browser/tabs/tab_strip_model_unittest.cc',
+ 'browser/template_url_model_unittest.cc',
+ 'browser/template_url_parser_unittest.cc',
+ 'browser/template_url_unittest.cc',
+ 'browser/title_chomper_unittest.cc',
+ 'browser/url_fetcher_unittest.cc',
+ 'browser/url_fixer_upper_unittest.cc',
+ 'browser/views/bookmark_bar_view_test.cc',
+ 'browser/views/bookmark_editor_view_unittest.cc',
+ 'browser/views/keyword_editor_view_unittest.cc',
+ 'browser/visitedlink_unittest.cc',
+ 'browser/web_contents_unittest.cc',
+ 'browser/webdata/web_database_unittest.cc',
+ 'browser/window_sizer_unittest.cc',
+ 'common/animation_unittest.cc',
+ 'common/bzip2_unittest.cc',
+ 'common/chrome_plugin_unittest.cc',
+ 'common/gfx/emf_unittest.cc',
+ 'common/gfx/icon_util_unittest.cc',
+ 'common/gfx/url_elider_unittest.cc',
+ 'common/ipc_message_unittest.cc',
+ 'common/ipc_sync_channel_unittest.cc',
+ 'common/ipc_sync_message_unittest.cc',
+ 'common/jpeg_codec_unittest.cc',
+ 'common/json_value_serializer_unittest.cc',
+ 'common/l10n_util_unittest.cc',
+ 'common/mru_cache_unittest.cc',
+ 'common/notification_service_unittest.cc',
+ 'common/os_exchange_data_unittest.cc',
+ 'common/pref_member_unittest.cc',
+ 'common/pref_service_unittest.cc',
+ 'common/resource_dispatcher_unittest.cc',
+ 'common/time_format_unittest.cc',
+ 'common/win_util_unittest.cc',
+ 'renderer/net/render_dns_master_unittest.cc',
+ 'renderer/net/render_dns_queue_unittest.cc',
+ 'renderer/spellcheck_unittest.cc',
+ 'views/focus_manager_unittest.cc',
+ 'views/grid_layout_unittest.cc',
+ 'views/view_unittest.cc',
+ 'test/test_notification_tracker.cc',
+ 'test/testing_profile.cc',
+ 'test/ui/view_event_test_base.cc',
+ # Commented out for now because googleurl_tests doesn't build with
+ # gtest; see ../build/SConscript.googleurl.
+ #'$GOOGLEURL_DIR/googleurl_tests.lib',
+ '$NET_DIR/url_request/url_request_test_job$OBJSUFFIX',
+
+ env_test['BROWSER_RES'],
+ env_test['TEST_DATA_RES'],
+ ])
+
+if env_test['PLATFORM'] in ('posix', 'win32'):
+ # TODO(port): This should work on all platforms.
+
+ test_program_files = unit_test_files
+ if env_test['PLATFORM'] == 'win32':
+ # This is probably Windows-specific.
+ test_program_files.extend(libs)
+ unit_tests = env_test.ChromeTestProgram('unit_tests', test_program_files)
-libs = [
- 'snapshotv8.lib',
-
- 'browser/browser.lib',
- 'browser/views/browser_views.lib',
- 'browser/debugger/debugger.lib',
- 'common/common.lib',
- 'installer/util/util.lib',
- 'libjscre.lib',
- 'plugin/plugin.lib',
- 'renderer/renderer.lib',
- 'test/chrome_plugin/test_chrome_plugin.lib',
- 'third_party/hunspell/hunspell.lib',
- 'third_party/sqlite/sqlite.lib',
- 'views/views.lib',
-]
-
-unit_test_files = [
- 'browser/autocomplete/autocomplete_unittest.cc',
- 'browser/autocomplete/history_contents_provider_unittest.cc',
- 'browser/autocomplete/history_url_provider_unittest.cc',
- 'browser/autocomplete/keyword_provider_unittest.cc',
- 'browser/back_forward_menu_model_unittest.cc',
- 'browser/bookmark_bar_context_menu_controller_test.cc',
- 'browser/bookmarks/bookmark_bar_unittest.cc',
- 'browser/bookmarks/bookmark_drag_data_unittest.cc',
- 'browser/cache_manager_host_unittest.cc',
- 'browser/chrome_thread_unittest.cc',
- 'browser/controller_unittest.cc',
- 'browser/download_manager_unittest.cc',
- 'browser/encryptor_unittest.cc',
- 'browser/firefox_importer_unittest.cc',
- 'browser/google_url_tracker_unittest.cc',
- 'browser/history/expire_history_backend_unittest.cc',
- 'browser/history/history_backend_unittest.cc',
- 'browser/history/history_querying_unittest.cc',
- 'browser/history/history_types_unittest.cc',
- 'browser/history/history_unittest.cc',
- 'browser/history/query_parser_unittest.cc',
- 'browser/history/snippet_unittest.cc',
- 'browser/history/starred_url_database_unittest.cc',
- 'browser/history/text_database_manager_unittest.cc',
- 'browser/history/text_database_unittest.cc',
- 'browser/history/thumbnail_database_unittest.cc',
- 'browser/history/url_database_unittest.cc',
- 'browser/history/visit_database_unittest.cc',
- 'browser/history/visit_tracker_unittest.cc',
- 'browser/importer_unittest.cc',
- 'browser/metrics_log_unittest.cc',
- 'browser/metrics_response_unittest.cc',
- 'browser/navigation_controller_unittest.cc',
- 'browser/net/dns_host_info_unittest.cc',
- 'browser/net/dns_master_unittest.cc',
- 'browser/password_form_manager_unittest.cc',
- 'browser/printing/page_number_unittest.cc',
- 'browser/printing/page_overlays_unittest.cc',
- 'browser/printing/page_range_unittest.cc',
- 'browser/printing/page_setup_unittest.cc',
- 'browser/printing/units_unittest.cc',
- 'browser/printing/win_printing_context_unittest.cc',
- 'browser/profile_manager_unittest.cc',
- 'browser/renderer_security_policy_unittest.cc',
- 'browser/resource_dispatcher_host_unittest.cc',
- 'browser/rlz/rlz_unittest.cc',
- 'browser/safe_browsing/bloom_filter_unittest.cc',
- 'browser/safe_browsing/chunk_range_unittest.cc',
- 'browser/safe_browsing/protocol_manager_unittest.cc',
- 'browser/safe_browsing/protocol_parser_unittest.cc',
- 'browser/safe_browsing/safe_browsing_database_unittest.cc',
- 'browser/safe_browsing/safe_browsing_util_unittest.cc',
- 'browser/save_package_unittest.cc',
- 'browser/session_backend_unittest.cc',
- 'browser/session_service_test_helper.cc',
- 'browser/session_service_unittest.cc',
- 'browser/site_instance_unittest.cc',
- 'browser/tabs/tab_strip_model_unittest.cc',
- 'browser/template_url_model_unittest.cc',
- 'browser/template_url_parser_unittest.cc',
- 'browser/template_url_unittest.cc',
- 'browser/title_chomper_unittest.cc',
- 'browser/url_fetcher_unittest.cc',
- 'browser/url_fixer_upper_unittest.cc',
- 'browser/views/bookmark_bar_view_test.cc',
- 'browser/views/bookmark_editor_view_unittest.cc',
- 'browser/views/keyword_editor_view_unittest.cc',
- 'browser/visitedlink_unittest.cc',
- 'browser/web_contents_unittest.cc',
- 'browser/webdata/web_database_unittest.cc',
- 'browser/window_sizer_unittest.cc',
- 'common/animation_unittest.cc',
- 'common/bzip2_unittest.cc',
- 'common/chrome_plugin_unittest.cc',
- 'common/gfx/emf_unittest.cc',
- 'common/gfx/icon_util_unittest.cc',
- 'common/gfx/url_elider_unittest.cc',
- 'common/ipc_message_unittest.cc',
- 'common/ipc_sync_channel_unittest.cc',
- 'common/ipc_sync_message_unittest.cc',
- 'common/jpeg_codec_unittest.cc',
- 'common/json_value_serializer_unittest.cc',
- 'common/l10n_util_unittest.cc',
- 'common/mru_cache_unittest.cc',
- 'common/notification_service_unittest.cc',
- 'common/os_exchange_data_unittest.cc',
- 'common/pref_member_unittest.cc',
- 'common/pref_service_unittest.cc',
- 'common/resource_dispatcher_unittest.cc',
- 'common/time_format_unittest.cc',
- 'common/win_util_unittest.cc',
- 'renderer/net/render_dns_master_unittest.cc',
- 'renderer/net/render_dns_queue_unittest.cc',
- 'renderer/spellcheck_unittest.cc',
- 'views/focus_manager_unittest.cc',
- 'views/grid_layout_unittest.cc',
- 'views/view_unittest.cc',
- 'test/test_notification_tracker.cc',
- 'test/testing_profile.cc',
- 'test/ui/view_event_test_base.cc',
- 'test/unit/run_all_unittests.cc',
- # Commented out for now because googleurl_tests doesn't build with
- # gtest; see ../build/SConscript.googleurl.
- #'$GOOGLEURL_DIR/googleurl_tests.lib',
- '$NET_DIR/url_request/url_request_test_job$OBJSUFFIX',
-
- env_test['BROWSER_RES'],
- env_test['TEST_DATA_RES'],
-]
-
-unit_tests = env_test.ChromeTestProgram('unit_tests', unit_test_files + libs)
-
-i = env_test.Install('$TARGET_ROOT', unit_tests)
-Alias('chrome', i)
+ i = env_test.Install('$TARGET_ROOT', unit_tests)
+ Alias('chrome', i)
diff --git a/chrome/browser/net/dns_host_info_unittest.cc b/chrome/browser/net/dns_host_info_unittest.cc
index 1f0e253..3ab5db7 100644
--- a/chrome/browser/net/dns_host_info_unittest.cc
+++ b/chrome/browser/net/dns_host_info_unittest.cc
@@ -7,6 +7,7 @@
#include <time.h>
#include <string>
+#include "base/platform_thread.h"
#include "chrome/browser/net/dns_host_info.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -28,7 +29,7 @@ TEST(DnsHostInfoTest, StateChangeTest) {
info_practice.SetQueuedState();
info_practice.SetAssignedState();
info_practice.SetFoundState();
- Sleep(500); // Allow time for DLLs to fully load.
+ PlatformThread::Sleep(500); // Allow time for DLLs to fully load.
// Complete the construction of real test object.
info.SetHostname(hostname1);
@@ -56,9 +57,10 @@ TEST(DnsHostInfoTest, StateChangeTest) {
EXPECT_FALSE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored";
// Note that we'll actually get an expiration (effectively) of
// 150ms, since there was no detected network activity time during lookup.
- Sleep(80); // Not enough time to pass our 150ms mark.
+ PlatformThread::Sleep(80); // Not enough time to pass our 150ms mark.
EXPECT_FALSE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored";
- Sleep(100); // Be sure we sleep (80+100) enough to pass that 150ms mark.
+ // Be sure we sleep (80+100) enough to pass that 150ms mark.
+ PlatformThread::Sleep(100);
EXPECT_TRUE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored";
// That was a nice life when the object was found.... but next time it won't
@@ -67,7 +69,8 @@ TEST(DnsHostInfoTest, StateChangeTest) {
info.SetAssignedState();
EXPECT_FALSE(info.NeedsDnsUpdate(hostname1))
<< "update needed while assigned to slave";
- Sleep(25); // Greater than minimal expected network latency on DNS lookup.
+ // Greater than minimal expected network latency on DNS lookup.
+ PlatformThread::Sleep(25);
info.SetNoSuchNameState();
EXPECT_FALSE(info.NeedsDnsUpdate(hostname1))
<< "default expiration time is TOOOOO short";
@@ -75,16 +78,17 @@ TEST(DnsHostInfoTest, StateChangeTest) {
// Note that now we'll actually utilize an expiration of 300ms,
// since there was detected network activity time during lookup.
// We're assuming the caching just started with our lookup.
- Sleep(80); // Not enough time to pass our 300ms mark.
+ PlatformThread::Sleep(80); // Not enough time to pass our 300ms mark.
EXPECT_FALSE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored";
- Sleep(80); // Still not past our 300ms mark (only about 4+2ms)
+ // Still not past our 300ms mark (only about 4+2ms)
+ PlatformThread::Sleep(80);
EXPECT_FALSE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored";
- Sleep(150);
+ PlatformThread::Sleep(150);
EXPECT_TRUE(info.NeedsDnsUpdate(hostname1)) << "expiration time not honored";
}
// TODO(jar): Add death test for illegal state changes, and also for setting
// hostname when already set.
-} // namespace anonymous
+} // namespace
diff --git a/chrome/browser/safe_browsing/chunk_range_unittest.cc b/chrome/browser/safe_browsing/chunk_range_unittest.cc
index bc409aa..e467dfd 100644
--- a/chrome/browser/safe_browsing/chunk_range_unittest.cc
+++ b/chrome/browser/safe_browsing/chunk_range_unittest.cc
@@ -48,7 +48,7 @@ TEST(SafeBrowsingChunkRangeTest, TestChunksToRanges) {
chunks.push_back(4);
chunks.push_back(7);
ChunksToRanges(chunks, &ranges);
- EXPECT_EQ(ranges.size(), 2);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(2));
EXPECT_EQ(ranges[0].start(), 1);
EXPECT_EQ(ranges[0].stop(), 4);
EXPECT_EQ(ranges[1].start(), 7);
@@ -67,7 +67,7 @@ TEST(SafeBrowsingChunkRangeTest, TestChunksToRanges) {
chunks.push_back(9);
chunks.push_back(10);
ChunksToRanges(chunks, &ranges);
- EXPECT_EQ(ranges.size(), 1);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(1));
EXPECT_EQ(ranges[0].start(), 3);
EXPECT_EQ(ranges[0].stop(), 10);
@@ -84,7 +84,7 @@ TEST(SafeBrowsingChunkRangeTest, TestChunksToRanges) {
chunks.push_back(15);
chunks.push_back(17);
ChunksToRanges(chunks, &ranges);
- EXPECT_EQ(ranges.size(), 8);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(8));
chunks.clear();
ranges.clear();
@@ -92,7 +92,7 @@ TEST(SafeBrowsingChunkRangeTest, TestChunksToRanges) {
// Test a single chunk number.
chunks.push_back(17);
ChunksToRanges(chunks, &ranges);
- EXPECT_EQ(ranges.size(), 1);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(1));
EXPECT_EQ(ranges[0].start(), 17);
EXPECT_EQ(ranges[0].stop(), 17);
@@ -110,7 +110,7 @@ TEST(SafeBrowsingChunkRangeTest, TestChunksToRanges) {
chunks.push_back(7);
chunks.push_back(7);
ChunksToRanges(chunks, &ranges);
- EXPECT_EQ(ranges.size(), 2);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(2));
EXPECT_EQ(ranges[0].start(), 1);
EXPECT_EQ(ranges[0].stop(), 3);
EXPECT_EQ(ranges[1].start(), 7);
@@ -123,7 +123,7 @@ TEST(SafeBrowsingChunkRangeTest, TestStringToRanges) {
std::string input = "1-100,398,415,1138-2001,2019";
EXPECT_TRUE(StringToRanges(input, &ranges));
- EXPECT_EQ(ranges.size(), 5);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(5));
EXPECT_EQ(ranges[0].start(), 1);
EXPECT_EQ(ranges[0].stop(), 100);
EXPECT_EQ(ranges[1].start(), 398);
@@ -135,13 +135,13 @@ TEST(SafeBrowsingChunkRangeTest, TestStringToRanges) {
input = "1,2,3,4,5,6,7";
EXPECT_TRUE(StringToRanges(input, &ranges));
- EXPECT_EQ(ranges.size(), 7);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(7));
ranges.clear();
input = "300-3001";
EXPECT_TRUE(StringToRanges(input, &ranges));
- EXPECT_EQ(ranges.size(), 1);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(1));
EXPECT_EQ(ranges[0].start(), 300);
EXPECT_EQ(ranges[0].stop(), 3001);
@@ -149,7 +149,7 @@ TEST(SafeBrowsingChunkRangeTest, TestStringToRanges) {
input = "17";
EXPECT_TRUE(StringToRanges(input, &ranges));
- EXPECT_EQ(ranges.size(), 1);
+ EXPECT_EQ(ranges.size(), static_cast<size_t>(1));
EXPECT_EQ(ranges[0].start(), 17);
EXPECT_EQ(ranges[0].stop(), 17);
@@ -168,7 +168,7 @@ TEST(SafeBrowsingChunkRangeTest, TestRangesToChunks) {
std::vector<int> chunks;
RangesToChunks(ranges, &chunks);
- EXPECT_EQ(chunks.size(), 5);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(5));
EXPECT_EQ(chunks[0], 1);
EXPECT_EQ(chunks[1], 2);
EXPECT_EQ(chunks[2], 3);
diff --git a/chrome/browser/safe_browsing/protocol_parser_unittest.cc b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
index a6d16d5..b05af83 100644
--- a/chrome/browser/safe_browsing/protocol_parser_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
@@ -7,7 +7,6 @@
#include "base/hash_tables.h"
#include "base/logging.h"
#include "base/string_util.h"
-#include "base/win_util.h"
#include "chrome/browser/safe_browsing/protocol_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -26,9 +25,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestAddChunk) {
"", "", &re_key, &chunks);
EXPECT_TRUE(result);
EXPECT_FALSE(re_key);
- EXPECT_EQ(chunks.size(), 1);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].chunk_number, 1);
- EXPECT_EQ(chunks[0].hosts.size(), 3);
+ EXPECT_EQ(chunks[0].hosts.size(), static_cast<size_t>(3));
EXPECT_EQ(chunks[0].hosts[0].host, 0x61616161);
SBEntry* entry = chunks[0].hosts[0].entry;
@@ -76,9 +75,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestAddFullChunk) {
"", "", &re_key, &chunks);
EXPECT_TRUE(result);
EXPECT_FALSE(re_key);
- EXPECT_EQ(chunks.size(), 1);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].chunk_number, 1);
- EXPECT_EQ(chunks[0].hosts.size(), 1);
+ EXPECT_EQ(chunks[0].hosts.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].hosts[0].host, 0x61616161);
SBEntry* entry = chunks[0].hosts[0].entry;
@@ -106,9 +105,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestAddChunks) {
"", "", &re_key, &chunks);
EXPECT_TRUE(result);
EXPECT_FALSE(re_key);
- EXPECT_EQ(chunks.size(), 2);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(2));
EXPECT_EQ(chunks[0].chunk_number, 1);
- EXPECT_EQ(chunks[0].hosts.size(), 3);
+ EXPECT_EQ(chunks[0].hosts.size(), static_cast<size_t>(3));
EXPECT_EQ(chunks[0].hosts[0].host, 0x61616161);
SBEntry* entry = chunks[0].hosts[0].entry;
@@ -132,7 +131,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestAddChunks) {
EXPECT_EQ(chunks[1].chunk_number, 2);
- EXPECT_EQ(chunks[1].hosts.size(), 1);
+ EXPECT_EQ(chunks[1].hosts.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[1].hosts[0].host, 0x35353535);
entry = chunks[1].hosts[0].entry;
@@ -164,10 +163,10 @@ TEST(SafeBrowsingProtocolParsingTest, TestAddBigChunk) {
"", "", &re_key, &chunks);
EXPECT_TRUE(result);
EXPECT_FALSE(re_key);
- EXPECT_EQ(chunks.size(), 1);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].chunk_number, 1);
- EXPECT_EQ(chunks[0].hosts.size(), 1);
+ EXPECT_EQ(chunks[0].hosts.size(), static_cast<size_t>(1));
const SBChunkHost& host = chunks[0].hosts[0];
EXPECT_EQ(host.host, 0x61616161);
@@ -192,9 +191,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestSubChunk) {
"", "", &re_key, &chunks);
EXPECT_TRUE(result);
EXPECT_FALSE(re_key);
- EXPECT_EQ(chunks.size(), 1);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].chunk_number, 9);
- EXPECT_EQ(chunks[0].hosts.size(), 3);
+ EXPECT_EQ(chunks[0].hosts.size(), static_cast<size_t>(3));
EXPECT_EQ(chunks[0].hosts[0].host, 0x61616161);
SBEntry* entry = chunks[0].hosts[0].entry;
@@ -250,9 +249,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestSubFullChunk) {
"", "", &re_key, &chunks);
EXPECT_TRUE(result);
EXPECT_FALSE(re_key);
- EXPECT_EQ(chunks.size(), 1);
+ EXPECT_EQ(chunks.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].chunk_number, 1);
- EXPECT_EQ(chunks[0].hosts.size(), 1);
+ EXPECT_EQ(chunks[0].hosts.size(), static_cast<size_t>(1));
EXPECT_EQ(chunks[0].hosts[0].host, 0x61616161);
SBEntry* entry = chunks[0].hosts[0].entry;
@@ -286,15 +285,15 @@ TEST(SafeBrowsingProtocolParsingTest, TestChunkDelete) {
EXPECT_FALSE(re_key);
EXPECT_FALSE(reset);
EXPECT_EQ(next_query_sec, 1700);
- EXPECT_EQ(deletes.size(), 2);
+ EXPECT_EQ(deletes.size(), static_cast<size_t>(2));
- EXPECT_EQ(deletes[0].chunk_del.size(), 4);
+ EXPECT_EQ(deletes[0].chunk_del.size(), static_cast<size_t>(4));
EXPECT_TRUE(deletes[0].chunk_del[0] == ChunkRange(1, 7));
EXPECT_TRUE(deletes[0].chunk_del[1] == ChunkRange(43, 597));
EXPECT_TRUE(deletes[0].chunk_del[2] == ChunkRange(44444));
EXPECT_TRUE(deletes[0].chunk_del[3] == ChunkRange(99999));
- EXPECT_EQ(deletes[1].chunk_del.size(), 3);
+ EXPECT_EQ(deletes[1].chunk_del.size(), static_cast<size_t>(3));
EXPECT_TRUE(deletes[1].chunk_del[0] == ChunkRange(21, 27));
EXPECT_TRUE(deletes[1].chunk_del[1] == ChunkRange(42));
EXPECT_TRUE(deletes[1].chunk_del[2] == ChunkRange(171717));
@@ -333,7 +332,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestRedirects) {
EXPECT_FALSE(re_key);
EXPECT_FALSE(reset);
- EXPECT_EQ(urls.size(), 4);
+ EXPECT_EQ(urls.size(), static_cast<size_t>(4));
EXPECT_EQ(urls[0].url,
"cache.googlevideo.com/safebrowsing/rd/goog-malware-shavar_s_1");
EXPECT_EQ(urls[1].url,
@@ -369,7 +368,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestRedirectsWithMac) {
EXPECT_FALSE(re_key);
EXPECT_FALSE(reset);
- EXPECT_EQ(urls.size(), 2);
+ EXPECT_EQ(urls.size(), static_cast<size_t>(2));
EXPECT_EQ(urls[0].url,
"s.ytimg.com/safebrowsing/rd/goog-phish-shavar_s_6501-6505:6501-6505");
EXPECT_EQ(urls[0].mac, "pcY6iVeT9-CBQ3fdAF0rpnKjR1Y=");
@@ -415,7 +414,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHash) {
&full_hashes);
EXPECT_FALSE(re_key);
- EXPECT_EQ(full_hashes.size(), 3);
+ EXPECT_EQ(full_hashes.size(), static_cast<size_t>(3));
EXPECT_EQ(memcmp(&full_hashes[0].hash,
"00112233445566778899aabbccddeeff",
sizeof(SBFullHash)), 0);
@@ -441,7 +440,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHash) {
&full_hashes);
EXPECT_FALSE(re_key);
- EXPECT_EQ(full_hashes.size(), 3);
+ EXPECT_EQ(full_hashes.size(), static_cast<size_t>(3));
EXPECT_EQ(memcmp(&full_hashes[0].hash,
"00112233445566778899aabbccddeeff",
sizeof(SBFullHash)), 0);
@@ -456,12 +455,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHash) {
EXPECT_EQ(full_hashes[2].list_name, "goog-malware-shavar");
}
+// TODO(port): Enable when we have ported VerifyMAC in safe_browsing_util.cc.
+#if defined(OS_WIN)
TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithMac) {
- // TODO(paulg): Bug: http://b/1084719, skip this test on Windows 2000 until
- // this bug is fixed.
- if (win_util::GetWinVersion() <= win_util::WINVERSION_2000)
- return;
-
const unsigned char get_hash[] = {
0x32, 0x56, 0x74, 0x6f, 0x6b, 0x36, 0x64, 0x41,
0x51, 0x72, 0x65, 0x51, 0x62, 0x38, 0x51, 0x68,
@@ -493,9 +489,10 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithMac) {
&re_key,
&full_hashes));
EXPECT_FALSE(re_key);
- EXPECT_EQ(full_hashes.size(), 1);
+ EXPECT_EQ(full_hashes.size(), static_cast<size_t>(1));
EXPECT_EQ(memcmp(hash_result, &full_hashes[0].hash, sizeof(SBFullHash)), 0);
}
+#endif // defined(OS_WIN)
TEST(SafeBrowsingProtocolParsingTest, TestFormatHash) {
@@ -558,12 +555,9 @@ TEST(SafeBrowsingProtocolParsingTest, TestReset) {
EXPECT_TRUE(reset);
}
+// TODO(port): Enable when we have ported VerifyMAC in safe_browsing_util.cc.
+#if defined(OS_WIN)
TEST(SafeBrowsingProtocolParsingTest, TestVerifyUpdateMac) {
- // TODO(paulg): Bug: http://b/1084719, skip this test on Windows 2000 until
- // this bug is fixed.
- if (win_util::GetWinVersion() <= win_util::WINVERSION_2000)
- return;
-
SafeBrowsingProtocolParser parser;
const std::string update =
@@ -599,11 +593,6 @@ TEST(SafeBrowsingProtocolParsingTest, TestVerifyUpdateMac) {
}
TEST(SafeBrowsingProtocolParsingTest, TestVerifyChunkMac) {
- // TODO(paulg): Bug: http://b/1084719, skip this test on Windows 2000 until
- // this bug is fixed.
- if (win_util::GetWinVersion() <= win_util::WINVERSION_2000)
- return;
-
SafeBrowsingProtocolParser parser;
const unsigned char chunk[] = {
@@ -626,3 +615,4 @@ TEST(SafeBrowsingProtocolParsingTest, TestVerifyChunkMac) {
safe_browsing_util::FreeChunks(&chunks);
}
+#endif // defined(OS_WIN)
diff --git a/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
index 9cb1167..2486117 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
@@ -37,8 +37,8 @@ TEST(SafeBrowsingUtilTest, UrlParsing) {
GURL url("http://a.b.c/1/2.html?param=1");
safe_browsing_util::GenerateHostsToCheck(url, &hosts);
safe_browsing_util::GeneratePathsToCheck(url, &paths);
- EXPECT_EQ(hosts.size(), 2);
- EXPECT_EQ(paths.size(), 4);
+ EXPECT_EQ(hosts.size(), static_cast<size_t>(2));
+ EXPECT_EQ(paths.size(), static_cast<size_t>(4));
EXPECT_EQ(hosts[0], "b.c");
EXPECT_EQ(hosts[1], "a.b.c");
@@ -50,8 +50,8 @@ TEST(SafeBrowsingUtilTest, UrlParsing) {
url = GURL("http://a.b.c.d.e.f.g/1.html");
safe_browsing_util::GenerateHostsToCheck(url, &hosts);
safe_browsing_util::GeneratePathsToCheck(url, &paths);
- EXPECT_EQ(hosts.size(), 5);
- EXPECT_EQ(paths.size(), 2);
+ EXPECT_EQ(hosts.size(), static_cast<size_t>(5));
+ EXPECT_EQ(paths.size(), static_cast<size_t>(2));
EXPECT_EQ(hosts[0], "f.g");
EXPECT_EQ(hosts[1], "e.f.g");
EXPECT_EQ(hosts[2], "d.e.f.g");
@@ -62,7 +62,7 @@ TEST(SafeBrowsingUtilTest, UrlParsing) {
url = GURL("http://a.b/saw-cgi/eBayISAPI.dll/");
safe_browsing_util::GeneratePathsToCheck(url, &paths);
- EXPECT_EQ(paths.size(), 3);
+ EXPECT_EQ(paths.size(), static_cast<size_t>(3));
EXPECT_TRUE(VectorContains(paths, "/saw-cgi/eBayISAPI.dll/"));
EXPECT_TRUE(VectorContains(paths, "/saw-cgi/"));
EXPECT_TRUE(VectorContains(paths, "/"));
diff --git a/chrome/test/unit/run_all_unittests.cc b/chrome/test/unit/run_all_unittests.cc
index 8a7419b..3ed4a73 100644
--- a/chrome/test/unit/run_all_unittests.cc
+++ b/chrome/test/unit/run_all_unittests.cc
@@ -2,9 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "build/build_config.h"
+
+#include "base/test_suite.h"
+
+// TODO(port): This is not Windows-specific, but needs to be ported.
+#if defined(OS_WIN)
#include "chrome/test/unit/chrome_test_suite.h"
+#endif
int main(int argc, char **argv) {
+#if defined(OS_WIN)
+ // TODO(port): This is not Windows-specific, but needs to be ported.
return ChromeTestSuite(argc, argv).Run();
+#else
+ return TestSuite(argc, argv).Run();
+#endif
}