diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-05 12:31:02 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-05 12:31:02 +0000 |
commit | 7e242b5aae22d77d2447c11041e7b01c49d133c3 (patch) | |
tree | 3015e7cac08f39c4ba66d53f4485a257ca3cd9d7 /chrome | |
parent | 9193185e11c562ad867007376f71ef9cefc08b17 (diff) | |
download | chromium_src-7e242b5aae22d77d2447c11041e7b01c49d133c3.zip chromium_src-7e242b5aae22d77d2447c11041e7b01c49d133c3.tar.gz chromium_src-7e242b5aae22d77d2447c11041e7b01c49d133c3.tar.bz2 |
Usual round of porting in chrome/
- make following unit tests run and pass on Linux:
browser/cache_manager_host_unittest.cc
browser/google_url_tracker_unittest.cc
- trivial cleanups needed for GCC
- remove CacheManagerHost and ResolveProxyMsgHelper from temporary scaffolding stubs and use real implementations instead
- update chrome.xcodeproj to reflect above change
Review URL: http://codereview.chromium.org/20057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9215 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.scons | 6 | ||||
-rw-r--r-- | chrome/browser/cache_manager_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/cache_manager_host_unittest.cc | 38 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/protocol_manager.cc | 5 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 30 | ||||
-rw-r--r-- | chrome/test/unit/unit_tests.scons | 2 |
7 files changed, 39 insertions, 56 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index 5c4fd8b..7924f91 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -687,7 +687,6 @@ if not env.Bit('windows'): 'browser_shutdown.cc', 'browser_url_handler.cc', 'browsing_data_remover.cc', - 'cache_manager_host.cc', 'cert_store.cc', 'character_encoding.cc', 'chrome_plugin_host.cc', @@ -708,7 +707,6 @@ if not env.Bit('windows'): 'download/save_item.cc', 'download/save_package.cc', 'download/save_page_model.cc', - 'extensions/extension_protocols.cc', 'drag_utils.cc', 'encoding_menu_controller_delegate.cc', 'external_protocol_handler.cc', @@ -736,10 +734,8 @@ if not env.Bit('windows'): 'net/dns_global.cc', 'net/dns_master.cc', 'net/dns_slave.cc', - 'net/resolve_proxy_msg_helper.cc', 'google_update.cc', 'password_manager/encryptor.cc', - 'password_manager/ie7_password.cc', 'password_manager/password_manager.cc', 'plugin_installer.cc', 'plugin_process_host.cc', @@ -767,7 +763,6 @@ if not env.Bit('windows'): 'sessions/session_backend.cc', 'sessions/session_restore.cc', 'sessions/session_service.cc', - 'sessions/session_types.cc', 'sessions/tab_restore_service.cc', 'shell_integration.cc', 'ssl/ssl_blocking_page.cc', @@ -804,6 +799,7 @@ if not env.Bit('windows'): 'importer/firefox_profile_lock_win.cc', 'js_before_unload_handler_win.cc', 'jsmessage_box_handler_win.cc', + 'password_manager/ie7_password.cc', 'password_manager/password_form_manager_win.cc', 'renderer_host/backing_store_win.cc', 'renderer_host/render_widget_host_view_win.cc', diff --git a/chrome/browser/cache_manager_host.cc b/chrome/browser/cache_manager_host.cc index 38db812..4423184 100644 --- a/chrome/browser/cache_manager_host.cc +++ b/chrome/browser/cache_manager_host.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <algorithm> - #include "chrome/browser/cache_manager_host.h" +#include <algorithm> + +#include "base/compiler_specific.h" #include "base/sys_info.h" #include "base/time.h" #include "chrome/browser/browser_process.h" @@ -54,8 +55,7 @@ CacheManagerHost* CacheManagerHost::GetInstance() { CacheManagerHost::CacheManagerHost() : global_size_limit_(GetDefaultGlobalSizeLimit()), -#pragma warning(suppress: 4355) // Okay to pass "this" here. - revise_allocation_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(revise_allocation_factory_(this)) { } CacheManagerHost::~CacheManagerHost() { diff --git a/chrome/browser/cache_manager_host_unittest.cc b/chrome/browser/cache_manager_host_unittest.cc index fe35bb3..e04c12c 100644 --- a/chrome/browser/cache_manager_host_unittest.cc +++ b/chrome/browser/cache_manager_host_unittest.cc @@ -81,7 +81,7 @@ class CacheManagerHostTest : public testing::Test { KEEP_LIVE_WITH_HEADROOM = CacheManagerHost::KEEP_LIVE_WITH_HEADROOM, KEEP_LIVE = CacheManagerHost::KEEP_LIVE, }; - + private: MessageLoop message_loop_; }; @@ -118,16 +118,16 @@ static bool operator==(const CacheManager::UsageStats& lhs, TEST_F(CacheManagerHostTest, AddRemoveRendererTest) { CacheManagerHost* h = CacheManagerHost::GetInstance(); - EXPECT_EQ(0, active_renderers(h).size()); - EXPECT_EQ(0, inactive_renderers(h).size()); + EXPECT_EQ(0U, active_renderers(h).size()); + EXPECT_EQ(0U, inactive_renderers(h).size()); h->Add(kRendererID); - EXPECT_EQ(1, active_renderers(h).count(kRendererID)); - EXPECT_EQ(0, inactive_renderers(h).count(kRendererID)); + EXPECT_EQ(1U, active_renderers(h).count(kRendererID)); + EXPECT_EQ(0U, inactive_renderers(h).count(kRendererID)); h->Remove(kRendererID); - EXPECT_EQ(0, active_renderers(h).size()); - EXPECT_EQ(0, inactive_renderers(h).size()); + EXPECT_EQ(0U, active_renderers(h).size()); + EXPECT_EQ(0U, inactive_renderers(h).size()); } TEST_F(CacheManagerHostTest, ActiveInactiveTest) { @@ -136,16 +136,16 @@ TEST_F(CacheManagerHostTest, ActiveInactiveTest) { h->Add(kRendererID); h->ObserveActivity(kRendererID); - EXPECT_EQ(1, active_renderers(h).count(kRendererID)); - EXPECT_EQ(0, inactive_renderers(h).count(kRendererID)); + EXPECT_EQ(1U, active_renderers(h).count(kRendererID)); + EXPECT_EQ(0U, inactive_renderers(h).count(kRendererID)); SimulateInactivity(h, kRendererID); - EXPECT_EQ(0, active_renderers(h).count(kRendererID)); - EXPECT_EQ(1, inactive_renderers(h).count(kRendererID)); + EXPECT_EQ(0U, active_renderers(h).count(kRendererID)); + EXPECT_EQ(1U, inactive_renderers(h).count(kRendererID)); h->ObserveActivity(kRendererID); - EXPECT_EQ(1, active_renderers(h).count(kRendererID)); - EXPECT_EQ(0, inactive_renderers(h).count(kRendererID)); + EXPECT_EQ(1U, active_renderers(h).count(kRendererID)); + EXPECT_EQ(0U, inactive_renderers(h).count(kRendererID)); h->Remove(kRendererID); } @@ -155,11 +155,11 @@ TEST_F(CacheManagerHostTest, ObserveStatsTest) { h->Add(kRendererID); - EXPECT_EQ(1, stats(h).size()); + EXPECT_EQ(1U, stats(h).size()); h->ObserveStats(kRendererID, kStats); - EXPECT_EQ(1, stats(h).size()); + EXPECT_EQ(1U, stats(h).size()); EXPECT_TRUE(kStats == stats(h)[kRendererID]); h->Remove(kRendererID); @@ -173,7 +173,7 @@ TEST_F(CacheManagerHostTest, SetGlobalSizeLimitTest) { EXPECT_EQ(limit, h->global_size_limit()); h->SetGlobalSizeLimit(0); - EXPECT_EQ(0, h->global_size_limit()); + EXPECT_EQ(0U, h->global_size_limit()); } TEST_F(CacheManagerHostTest, GatherStatsTest) { @@ -210,7 +210,7 @@ TEST_F(CacheManagerHostTest, GatherStatsTest) { } TEST_F(CacheManagerHostTest, GetSizeTest) { - EXPECT_EQ(0, GetSize(DIVIDE_EVENLY, kStats)); + EXPECT_EQ(0U, GetSize(DIVIDE_EVENLY, kStats)); EXPECT_LT(256 * 1024u + 512, GetSize(KEEP_CURRENT_WITH_HEADROOM, kStats)); EXPECT_EQ(256 * 1024u + 512, GetSize(KEEP_CURRENT, kStats)); EXPECT_LT(256 * 1024u, GetSize(KEEP_LIVE_WITH_HEADROOM, kStats)); @@ -248,7 +248,7 @@ TEST_F(CacheManagerHostTest, AttemptTacticTest) { KEEP_LIVE, kStats2, &strategy)); - EXPECT_EQ(2, strategy.size()); + EXPECT_EQ(2U, strategy.size()); AllocationStrategy::iterator iter = strategy.begin(); while (iter != strategy.end()) { @@ -287,7 +287,7 @@ TEST_F(CacheManagerHostTest, AddToStrategyTest) { kExtraBytesToAllocate, &strategy); - EXPECT_EQ(2, strategy.size()); + EXPECT_EQ(2U, strategy.size()); size_t total_bytes = 0; AllocationStrategy::iterator iter = strategy.begin(); diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 5086e22..df83f8e 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -243,6 +243,9 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete( UpdateFinished(true); } break; + default: + NOTREACHED(); + break; } } else if (response_code >= 300) { @@ -590,4 +593,4 @@ void SafeBrowsingProtocolManager::UpdateFinished(bool success) { UMA_HISTOGRAM_COUNTS(L"SB2.UpdateSize", update_size_); update_size_ = 0; sb_service_->UpdateFinished(success); -}
\ No newline at end of file +} diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index aa93002..09ef15d 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -86,6 +86,7 @@ 3380A9D70F2FC8F9004EF74F /* render_dns_master.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640CE10EAE86A500EBCFC0 /* render_dns_master.cc */; }; 3AEA44DB19C9D93B63D7A2E4 /* url_fetcher_protect.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0B7CC9C105E90E0665852528 /* url_fetcher_protect.cc */; }; 406DFE278638D6132B21B2C9 /* url_pattern.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6447F24FADC63E58A44DB762 /* url_pattern.cc */; }; + 475CAF858604B413561740C1 /* cache_manager_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8520E9D4839009A6919 /* cache_manager_host.cc */; }; 4D175916B2FC058793051209 /* chrome_paths_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */; }; 4D1F59FE0F2A6BBB0040C1E3 /* image_diff.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D1F59FD0F2A6BBB0040C1E3 /* image_diff.cc */; }; 4D1F5A060F2A6D170040C1E3 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC70E9D525B009A6919 /* libbase.a */; }; @@ -245,6 +246,7 @@ A7C613C10F30D7E4008CEE5D /* mock_render_process_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = A7C613BF0F30D7E4008CEE5D /* mock_render_process_host.cc */; }; A7C6146F0F30DA1D008CEE5D /* ipc_test_sink.cc in Sources */ = {isa = PBXBuildFile; fileRef = A7C6146D0F30DA1D008CEE5D /* ipc_test_sink.cc */; }; A7CBAD390F322A7E00360BF5 /* shell_dialogs_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A7CBAD370F322A7E00360BF5 /* shell_dialogs_mac.mm */; }; + B0AC9501DED2809AC208AEEA /* resolve_proxy_msg_helper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4F9429998AC2703984BAB828 /* resolve_proxy_msg_helper.cc */; }; B502DA280F098056005BE90C /* visit_database_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFA180E9D48F7009A6919 /* visit_database_unittest.cc */; }; B502DA520F098888005BE90C /* l10n_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBC90E9D4C9F009A6919 /* l10n_util.cc */; }; B503E0F00F0175FD00547DC6 /* user_script_slave.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640CC90EAE868600EBCFC0 /* user_script_slave.cc */; }; @@ -1866,6 +1868,7 @@ 4D7FA6210F13CA04004F1B19 /* ui_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ui_tests; sourceTree = BUILT_PRODUCTS_DIR; }; 4DCE9E2C0EF0B8C000682526 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; }; 4DDC64500EAE392400FB5EBE /* zlib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = zlib.xcodeproj; path = third_party/zlib/zlib.xcodeproj; sourceTree = "<group>"; }; + 4F9429998AC2703984BAB828 /* resolve_proxy_msg_helper.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = resolve_proxy_msg_helper.cc; sourceTree = "<group>"; }; 534E66C30F311BEC0006B2B2 /* temp_scaffolding_stubs.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = temp_scaffolding_stubs.cc; sourceTree = "<group>"; }; 56E1D7DF17D327BFCB0B895D /* test_web_contents.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = test_web_contents.cc; path = browser/tab_contents/test_web_contents.cc; sourceTree = SOURCE_ROOT; }; 629BF493DEA096E2DD844F2B /* autofill_manager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = autofill_manager.cc; sourceTree = "<group>"; }; @@ -2841,6 +2844,7 @@ 4D7BFA710E9D4981009A6919 /* dns_slave.h */, E4F324780EE5D17E002533CE /* referrer.h */, E4F324790EE5D17E002533CE /* referrer.cc */, + 4F9429998AC2703984BAB828 /* resolve_proxy_msg_helper.cc */, 4D7BFA720E9D4981009A6919 /* sdch_dictionary_fetcher.cc */, 4D7BFA730E9D4981009A6919 /* sdch_dictionary_fetcher.h */, 778D7927798B7E3FAA498D3D /* url_fetcher.cc */, @@ -4568,6 +4572,7 @@ E48B684D0F2630D3002E47EC /* browser_window_factory.mm in Sources */, E434BBD00F37D93C00B665C7 /* browsing_instance.cc in Sources */, E45075E20F150A6F003BE099 /* buffered_resource_handler.cc in Sources */, + 475CAF858604B413561740C1 /* cache_manager_host.cc in Sources */, 4D7BF98D0E9D485B009A6919 /* cancelable_request.cc in Sources */, E43A770D0F16610300ABD5D1 /* chrome_plugin_browsing_context.cc in Sources */, 4D7BF9920E9D485F009A6919 /* chrome_thread.cc in Sources */, @@ -4620,6 +4625,7 @@ E434BBBF0F37D6DB00B665C7 /* render_widget_helper.cc in Sources */, E434BFA40F3A03E200B665C7 /* render_widget_host.cc in Sources */, E434BBEB0F37DFA500B665C7 /* renderer_security_policy.cc in Sources */, + B0AC9501DED2809AC208AEEA /* resolve_proxy_msg_helper.cc in Sources */, 4D7BFAF30E9D49EF009A6919 /* safe_browsing_database.cc in Sources */, E48FB9590EC4E9C10052B72B /* safe_browsing_database_bloom.cc in Sources */, E48FB95C0EC4E9DD0052B72B /* safe_browsing_database_impl.cc in Sources */, diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index 299517b..cc5fbe6 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -203,7 +203,7 @@ std::string GetUserAgent(const GURL& url) { NOTIMPLEMENTED(); return ""; } -// TODO(pinkerton): when these are removed, mock_webkit_glue.cc +// TODO(pinkerton): when these are removed, mock_webkit_glue.cc // must be re-added to the unit_test target for tests. void SetRecordPlaybackMode(bool) { } void SetJavaScriptFlags(const std::wstring&) { } @@ -237,22 +237,10 @@ void RunJavascriptMessageBox(WebContents* web_contents, NOTIMPLEMENTED(); } -CacheManagerHost::CacheManagerHost() : revise_allocation_factory_(this) { } -CacheManagerHost::~CacheManagerHost() { } -void CacheManagerHost::ObserveActivity(int) { NOTIMPLEMENTED(); } -void CacheManagerHost::Remove(int) { NOTIMPLEMENTED(); } -void CacheManagerHost::Add(int) { NOTIMPLEMENTED(); } -void CacheManagerHost::ObserveStats(int, const CacheManager::UsageStats&) { - NOTIMPLEMENTED(); -} -CacheManagerHost* CacheManagerHost::GetInstance() { - return Singleton<CacheManagerHost>::get(); -} - void RunBeforeUnloadDialog(WebContents* web_contents, const std::wstring& message_text, IPC::Message* reply_msg) { - NOTIMPLEMENTED(); + NOTIMPLEMENTED(); } bool SSLManager::DeserializeSecurityInfo(const std::string&, int*, int*, int*) { @@ -269,7 +257,7 @@ ResourceMessageFilter::ResourceMessageFilter( int render_process_host_id, Profile* profile, RenderWidgetHelper* render_widget_helper, - SpellChecker* spellchecker) + SpellChecker* spellchecker) : ALLOW_THIS_IN_INITIALIZER_LIST(resolve_proxy_msg_helper_(this, NULL)) { } ResourceMessageFilter::~ResourceMessageFilter() { NOTIMPLEMENTED(); } @@ -296,19 +284,11 @@ void ResourceMessageFilter::OnResolveProxyCompleted( NOTIMPLEMENTED(); } -ResolveProxyMsgHelper::ResolveProxyMsgHelper(Delegate* delegate, - net::ProxyService* proxy_service) - : ALLOW_THIS_IN_INITIALIZER_LIST(callback_( - this, &ResolveProxyMsgHelper::OnResolveProxyCompleted)) { -} -ResolveProxyMsgHelper::~ResolveProxyMsgHelper() { } -void ResolveProxyMsgHelper::OnResolveProxyCompleted(int) { NOTIMPLEMENTED(); } - #if defined(OS_MACOSX) ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; // GetBitmapNamed() will leak, but there's no way around it for stubs. -SkBitmap* ResourceBundle::GetBitmapNamed(int) { +SkBitmap* ResourceBundle::GetBitmapNamed(int) { NOTIMPLEMENTED(); return new SkBitmap(); } @@ -328,7 +308,7 @@ void ResourceDispatcherHost::CancelRequestsForRenderView(int, int) { NOTIMPLEMENTED(); } -void ProcessWatcher::EnsureProcessTerminated(int) { +void ProcessWatcher::EnsureProcessTerminated(int) { NOTIMPLEMENTED(); } diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons index af74fe6..4a2c333 100644 --- a/chrome/test/unit/unit_tests.scons +++ b/chrome/test/unit/unit_tests.scons @@ -381,13 +381,11 @@ if not env.Bit('windows'): '$CHROME_DIR/browser/bookmarks/bookmark_table_model_unittest.cc', '$CHROME_DIR/browser/bookmarks/bookmark_utils_unittest.cc', '$CHROME_DIR/browser/browser_commands_unittest.cc', - '$CHROME_DIR/browser/cache_manager_host_unittest.cc', '$CHROME_DIR/browser/command_updater_unittest.cc', '$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/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', |