diff options
53 files changed, 607 insertions, 312 deletions
diff --git a/net/base/address_list_net_log_param.h b/net/base/address_list_net_log_param.h index b33fee1..c64150c 100644 --- a/net/base/address_list_net_log_param.h +++ b/net/base/address_list_net_log_param.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -20,6 +20,9 @@ class AddressListNetLogParam : public NetLog::EventParameters { virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~AddressListNetLogParam() {} + private: AddressList address_list_; }; diff --git a/net/base/default_server_bound_cert_store.cc b/net/base/default_server_bound_cert_store.cc index 3252899..2f891ca 100644 --- a/net/base/default_server_bound_cert_store.cc +++ b/net/base/default_server_bound_cert_store.cc @@ -177,4 +177,6 @@ void DefaultServerBoundCertStore::InternalInsertServerBoundCert( DefaultServerBoundCertStore::PersistentStore::PersistentStore() {} +DefaultServerBoundCertStore::PersistentStore::~PersistentStore() {} + } // namespace net diff --git a/net/base/default_server_bound_cert_store.h b/net/base/default_server_bound_cert_store.h index cd664fe..daec007 100644 --- a/net/base/default_server_bound_cert_store.h +++ b/net/base/default_server_bound_cert_store.h @@ -129,8 +129,6 @@ typedef base::RefCountedThreadSafe<DefaultServerBoundCertStore::PersistentStore> class NET_EXPORT DefaultServerBoundCertStore::PersistentStore : public RefcountedPersistentStore { public: - virtual ~PersistentStore() {} - // Initializes the store and retrieves the existing certs. This will be // called only once at startup. Note that the certs are individually allocated // and that ownership is transferred to the caller upon return. @@ -149,7 +147,10 @@ class NET_EXPORT DefaultServerBoundCertStore::PersistentStore virtual void Flush(const base::Closure& completion_task) = 0; protected: + friend class base::RefCountedThreadSafe<PersistentStore>; + PersistentStore(); + virtual ~PersistentStore(); private: DISALLOW_COPY_AND_ASSIGN(PersistentStore); diff --git a/net/base/default_server_bound_cert_store_unittest.cc b/net/base/default_server_bound_cert_store_unittest.cc index fb94234a..38053c9 100644 --- a/net/base/default_server_bound_cert_store_unittest.cc +++ b/net/base/default_server_bound_cert_store_unittest.cc @@ -20,7 +20,6 @@ class MockPersistentStore : public DefaultServerBoundCertStore::PersistentStore { public: MockPersistentStore(); - virtual ~MockPersistentStore(); // DefaultServerBoundCertStore::PersistentStore implementation. virtual bool Load( @@ -33,6 +32,9 @@ class MockPersistentStore virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; virtual void Flush(const base::Closure& completion_task) OVERRIDE; + protected: + virtual ~MockPersistentStore(); + private: typedef std::map<std::string, DefaultServerBoundCertStore::ServerBoundCert> ServerBoundCertMap; @@ -42,8 +44,6 @@ class MockPersistentStore MockPersistentStore::MockPersistentStore() {} -MockPersistentStore::~MockPersistentStore() {} - bool MockPersistentStore::Load( std::vector<DefaultServerBoundCertStore::ServerBoundCert*>* certs) { ServerBoundCertMap::iterator it; @@ -72,6 +72,8 @@ void MockPersistentStore::Flush(const base::Closure& completion_task) { NOTREACHED(); } +MockPersistentStore::~MockPersistentStore() {} + TEST(DefaultServerBoundCertStoreTest, TestLoading) { scoped_refptr<MockPersistentStore> persistent_store(new MockPersistentStore); diff --git a/net/base/file_stream_net_log_parameters.cc b/net/base/file_stream_net_log_parameters.cc index 3a8c42f..731e739 100644 --- a/net/base/file_stream_net_log_parameters.cc +++ b/net/base/file_stream_net_log_parameters.cc @@ -13,6 +13,8 @@ FileStreamErrorParameters::FileStreamErrorParameters( : operation_(operation), os_error_(os_error), net_error_(net_error) { } +FileStreamErrorParameters::~FileStreamErrorParameters() {} + Value* FileStreamErrorParameters::ToValue() const { DictionaryValue* dict = new DictionaryValue(); diff --git a/net/base/file_stream_net_log_parameters.h b/net/base/file_stream_net_log_parameters.h index 92689ab..a1630b8 100644 --- a/net/base/file_stream_net_log_parameters.h +++ b/net/base/file_stream_net_log_parameters.h @@ -23,6 +23,9 @@ class FileStreamErrorParameters : public net::NetLog::EventParameters { net::Error net_error); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~FileStreamErrorParameters(); + private: std::string operation_; int os_error_; diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 0525459..541246f 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -175,6 +175,9 @@ class CallSystemHostResolverProc : public HostResolverProc { addr_list, os_error); } + + protected: + virtual ~CallSystemHostResolverProc() {} }; // Extra parameters to attach to the NetLog when the resolve failed. @@ -216,6 +219,9 @@ class ProcTaskFailedParams : public NetLog::EventParameters { return dict; } + protected: + virtual ~ProcTaskFailedParams() {} + private: const uint32 attempt_number_; const int net_error_; @@ -237,6 +243,9 @@ class DnsTaskFailedParams : public NetLog::EventParameters { return dict; } + protected: + virtual ~DnsTaskFailedParams() {} + private: const int net_error_; const int dns_error_; @@ -265,6 +274,9 @@ class RequestInfoParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~RequestInfoParameters() {} + private: const HostResolver::RequestInfo info_; const NetLog::Source source_; @@ -284,6 +296,9 @@ class JobCreationParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~JobCreationParameters() {} + private: const std::string host_; const NetLog::Source source_; @@ -303,6 +318,9 @@ class JobAttachParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~JobAttachParameters() {} + private: const NetLog::Source source_; const RequestPriority priority_; @@ -326,6 +344,9 @@ class DnsConfigParameters : public NetLog::EventParameters { return value; } + protected: + virtual ~DnsConfigParameters() {} + private: DnsConfig config_; // Does not include DnsHosts to save memory and work. const size_t num_hosts_; @@ -635,6 +656,9 @@ class HostResolverImpl::ProcTask } private: + friend class base::RefCountedThreadSafe<ProcTask>; + ~ProcTask() {} + void StartLookupAttempt() { DCHECK(origin_loop_->BelongsToCurrentThread()); base::TimeTicks start_time = base::TimeTicks::Now(); diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc index 8a071b7..d82f6f7 100644 --- a/net/base/host_resolver_impl_unittest.cc +++ b/net/base/host_resolver_impl_unittest.cc @@ -197,9 +197,10 @@ class MockHostResolverProc : public HostResolverProc { return num_requests_waiting_ > num_slots_available_; } - private: + protected: ~MockHostResolverProc() {} + private: mutable base::Lock lock_; std::map<ResolveKey, AddressList> rules_; CaptureList capture_list_; @@ -434,9 +435,10 @@ class LookupAttemptHostResolverProc : public HostResolverProc { return result; } - private: + protected: virtual ~LookupAttemptHostResolverProc() {} + private: int attempt_number_to_resolve_; int current_attempt_number_; // Incremented whenever Resolve is called. int total_attempts_; diff --git a/net/base/listen_socket.h b/net/base/listen_socket.h index f102462..29ac620 100644 --- a/net/base/listen_socket.h +++ b/net/base/listen_socket.h @@ -27,8 +27,6 @@ class NET_EXPORT ListenSocket // should be split up similarly. class ListenSocketDelegate { public: - virtual ~ListenSocketDelegate() {} - // server is the original listening Socket, connection is the new // Socket that was created. Ownership of connection is transferred // to the delegate with this call. @@ -38,6 +36,9 @@ class NET_EXPORT ListenSocket const char* data, int len) = 0; virtual void DidClose(ListenSocket *sock) = 0; + + protected: + virtual ~ListenSocketDelegate() {} }; // Send data to the socket. diff --git a/net/base/net_log.cc b/net/base/net_log.cc index 0b23907..0f0b719 100644 --- a/net/base/net_log.cc +++ b/net/base/net_log.cc @@ -23,6 +23,9 @@ class NetLogBytesTransferredParameter : public NetLog::EventParameters { virtual Value* ToValue() const; + protected: + virtual ~NetLogBytesTransferredParameter() {} + private: const int byte_count_; std::string hex_encoded_bytes_; diff --git a/net/base/net_log.h b/net/base/net_log.h index 707c321..1984abf 100644 --- a/net/base/net_log.h +++ b/net/base/net_log.h @@ -78,14 +78,18 @@ class NET_EXPORT NetLog { : public base::RefCountedThreadSafe<EventParameters> { public: EventParameters() {} - virtual ~EventParameters() {} // Serializes the parameters to a Value tree. This is intended to be a // lossless conversion, which is used to serialize the parameters to JSON. // The caller takes ownership of the returned Value*. virtual base::Value* ToValue() const = 0; + protected: + virtual ~EventParameters() {} + private: + friend class base::RefCountedThreadSafe<EventParameters>; + DISALLOW_COPY_AND_ASSIGN(EventParameters); }; @@ -321,7 +325,6 @@ class NET_EXPORT NetLogStringParameter : public NetLog::EventParameters { public: // |name| must be a string literal. NetLogStringParameter(const char* name, const std::string& value); - virtual ~NetLogStringParameter(); const std::string& value() const { return value_; @@ -329,6 +332,9 @@ class NET_EXPORT NetLogStringParameter : public NetLog::EventParameters { virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~NetLogStringParameter(); + private: const char* const name_; const std::string value_; @@ -348,6 +354,9 @@ class NET_EXPORT NetLogIntegerParameter : public NetLog::EventParameters { virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~NetLogIntegerParameter() {} + private: const char* name_; const int value_; @@ -367,6 +376,9 @@ class NET_EXPORT NetLogSourceParameter : public NetLog::EventParameters { virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~NetLogSourceParameter() {} + private: const char* name_; const NetLog::Source value_; diff --git a/net/base/x509_certificate_net_log_param.cc b/net/base/x509_certificate_net_log_param.cc index 03e8a3cb..693a7ff 100644 --- a/net/base/x509_certificate_net_log_param.cc +++ b/net/base/x509_certificate_net_log_param.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,8 +14,6 @@ X509CertificateNetLogParam::X509CertificateNetLogParam( certificate->GetPEMEncodedChain(&encoded_chain_); } -X509CertificateNetLogParam::~X509CertificateNetLogParam() {} - base::Value* X509CertificateNetLogParam::ToValue() const { DictionaryValue* dict = new DictionaryValue(); ListValue* certs = new ListValue(); @@ -25,4 +23,6 @@ base::Value* X509CertificateNetLogParam::ToValue() const { return dict; } +X509CertificateNetLogParam::~X509CertificateNetLogParam() {} + } // namespace net diff --git a/net/base/x509_certificate_net_log_param.h b/net/base/x509_certificate_net_log_param.h index 97b8515f..a6ec6a4 100644 --- a/net/base/x509_certificate_net_log_param.h +++ b/net/base/x509_certificate_net_log_param.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -22,10 +22,12 @@ class X509Certificate; class X509CertificateNetLogParam : public NetLog::EventParameters { public: explicit X509CertificateNetLogParam(X509Certificate* certificate); - virtual ~X509CertificateNetLogParam(); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~X509CertificateNetLogParam(); + private: std::vector<std::string> encoded_chain_; }; diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc index 84fc30d..8f516ce 100644 --- a/net/cookies/cookie_monster.cc +++ b/net/cookies/cookie_monster.cc @@ -532,9 +532,9 @@ class CookieMonster::CookieMonsterTask return cookie_monster_; } + private: friend class base::RefCountedThreadSafe<CookieMonsterTask>; - private: CookieMonster* cookie_monster_; scoped_refptr<base::MessageLoopProxy> thread_; @@ -544,9 +544,10 @@ class CookieMonster::CookieMonsterTask CookieMonster::CookieMonsterTask::CookieMonsterTask( CookieMonster* cookie_monster) : cookie_monster_(cookie_monster), - thread_(base::MessageLoopProxy::current()) { } + thread_(base::MessageLoopProxy::current()) { +} -CookieMonster::CookieMonsterTask::~CookieMonsterTask() { } +CookieMonster::CookieMonsterTask::~CookieMonsterTask() {} // Unfortunately, one cannot re-bind a Callback with parameters into a closure. // Therefore, the closure passed to InvokeCallback is a clumsy binding of @@ -586,10 +587,15 @@ class CookieMonster::SetCookieWithDetailsTask expiration_time_(expiration_time), secure_(secure), http_only_(http_only), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~SetCookieWithDetailsTask() {} + private: GURL url_; std::string name_; @@ -621,10 +627,15 @@ class CookieMonster::GetAllCookiesTask GetAllCookiesTask(CookieMonster* cookie_monster, const CookieMonster::GetCookieListCallback& callback) : CookieMonsterTask(cookie_monster), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask virtual void Run() OVERRIDE; + protected: + virtual ~GetAllCookiesTask() {} + private: CookieMonster::GetCookieListCallback callback_; @@ -651,10 +662,15 @@ class CookieMonster::GetAllCookiesForURLWithOptionsTask : CookieMonsterTask(cookie_monster), url_(url), options_(options), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~GetAllCookiesForURLWithOptionsTask() {} + private: GURL url_; CookieOptions options_; @@ -678,10 +694,15 @@ class CookieMonster::DeleteAllTask : public CookieMonster::CookieMonsterTask { DeleteAllTask(CookieMonster* cookie_monster, const CookieMonster::DeleteCallback& callback) : CookieMonsterTask(cookie_monster), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~DeleteAllTask() {} + private: CookieMonster::DeleteCallback callback_; @@ -708,10 +729,15 @@ class CookieMonster::DeleteAllCreatedBetweenTask : CookieMonsterTask(cookie_monster), delete_begin_(delete_begin), delete_end_(delete_end), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~DeleteAllCreatedBetweenTask() {} + private: Time delete_begin_; Time delete_end_; @@ -738,10 +764,15 @@ class CookieMonster::DeleteAllForHostTask const CookieMonster::DeleteCallback& callback) : CookieMonsterTask(cookie_monster), url_(url), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~DeleteAllForHostTask() {} + private: GURL url_; CookieMonster::DeleteCallback callback_; @@ -767,10 +798,15 @@ class CookieMonster::DeleteCanonicalCookieTask const CookieMonster::DeleteCookieCallback& callback) : CookieMonsterTask(cookie_monster), cookie_(cookie), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~DeleteCanonicalCookieTask() {} + private: CookieMonster::CanonicalCookie cookie_; CookieMonster::DeleteCookieCallback callback_; @@ -799,10 +835,15 @@ class CookieMonster::SetCookieWithOptionsTask url_(url), cookie_line_(cookie_line), options_(options), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~SetCookieWithOptionsTask() {} + private: GURL url_; std::string cookie_line_; @@ -832,10 +873,15 @@ class CookieMonster::GetCookiesWithOptionsTask : CookieMonsterTask(cookie_monster), url_(url), options_(options), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~GetCookiesWithOptionsTask() {} + private: GURL url_; CookieOptions options_; @@ -866,8 +912,12 @@ class CookieMonster::GetCookiesWithInfoTask options_(options), callback_(callback) { } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~GetCookiesWithInfoTask() {} + private: GURL url_; CookieOptions options_; @@ -901,8 +951,12 @@ class CookieMonster::DeleteCookieTask cookie_name_(cookie_name), callback_(callback) { } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~DeleteCookieTask() {} + private: GURL url_; std::string cookie_name_; @@ -926,10 +980,15 @@ class CookieMonster::DeleteSessionCookiesTask CookieMonster* cookie_monster, const CookieMonster::DeleteCallback& callback) : CookieMonsterTask(cookie_monster), - callback_(callback) { } + callback_(callback) { + } + // CookieMonster::CookieMonsterTask: virtual void Run() OVERRIDE; + protected: + virtual ~DeleteSessionCookiesTask() {} + private: CookieMonster::DeleteCallback callback_; diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h index 1eced59..8eef2ba 100644 --- a/net/cookies/cookie_monster.h +++ b/net/cookies/cookie_monster.h @@ -932,8 +932,6 @@ typedef base::RefCountedThreadSafe<CookieMonster::PersistentCookieStore> class CookieMonster::PersistentCookieStore : public RefcountedPersistentCookieStore { public: - virtual ~PersistentCookieStore() {} - typedef base::Callback<void(const std::vector< CookieMonster::CanonicalCookie*>&)> LoadedCallback; @@ -963,8 +961,10 @@ class CookieMonster::PersistentCookieStore protected: PersistentCookieStore() {} + virtual ~PersistentCookieStore() {} private: + friend class base::RefCountedThreadSafe<PersistentCookieStore>; DISALLOW_COPY_AND_ASSIGN(PersistentCookieStore); }; diff --git a/net/cookies/cookie_monster_store_test.cc b/net/cookies/cookie_monster_store_test.cc index 822aacc..f347e8d 100644 --- a/net/cookies/cookie_monster_store_test.cc +++ b/net/cookies/cookie_monster_store_test.cc @@ -25,8 +25,6 @@ MockPersistentCookieStore::MockPersistentCookieStore() loaded_(false) { } -MockPersistentCookieStore::~MockPersistentCookieStore() {} - void MockPersistentCookieStore::SetLoadExpectation( bool return_value, const std::vector<CookieMonster::CanonicalCookie*>& result) { @@ -85,6 +83,8 @@ void MockPersistentCookieStore::SetClearLocalStateOnExit(bool clear_local_state) { } +MockPersistentCookieStore::~MockPersistentCookieStore() {} + MockCookieMonsterDelegate::MockCookieMonsterDelegate() {} void MockCookieMonsterDelegate::OnCookieChanged( @@ -97,18 +97,6 @@ void MockCookieMonsterDelegate::OnCookieChanged( MockCookieMonsterDelegate::~MockCookieMonsterDelegate() {} -void AddCookieToList( - const std::string& key, - const std::string& cookie_line, - const base::Time& creation_time, - std::vector<CookieMonster::CanonicalCookie*>* out_list) { - scoped_ptr<CookieMonster::CanonicalCookie> cookie( - new CookieMonster::CanonicalCookie( - BuildCanonicalCookie(key, cookie_line, creation_time))); - - out_list->push_back(cookie.release()); -} - CookieMonster::CanonicalCookie BuildCanonicalCookie( const std::string& key, const std::string& cookie_line, @@ -135,10 +123,21 @@ CookieMonster::CanonicalCookie BuildCanonicalCookie( !cookie_expires.is_null(), !cookie_expires.is_null()); } -MockSimplePersistentCookieStore::MockSimplePersistentCookieStore() - : loaded_(false) {} +void AddCookieToList( + const std::string& key, + const std::string& cookie_line, + const base::Time& creation_time, + std::vector<CookieMonster::CanonicalCookie*>* out_list) { + scoped_ptr<CookieMonster::CanonicalCookie> cookie( + new CookieMonster::CanonicalCookie( + BuildCanonicalCookie(key, cookie_line, creation_time))); -MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} + out_list->push_back(cookie.release()); +} + +MockSimplePersistentCookieStore::MockSimplePersistentCookieStore() + : loaded_(false) { +} void MockSimplePersistentCookieStore::Load( const LoadedCallback& loaded_callback) { @@ -228,4 +227,6 @@ CookieMonster* CreateMonsterFromStoreForGC( return new CookieMonster(store, NULL); } +MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} + } // namespace net diff --git a/net/cookies/cookie_monster_store_test.h b/net/cookies/cookie_monster_store_test.h index a05ddd3..fd4218d 100644 --- a/net/cookies/cookie_monster_store_test.h +++ b/net/cookies/cookie_monster_store_test.h @@ -33,13 +33,15 @@ class LoadedCallbackTask LoadedCallbackTask(LoadedCallback loaded_callback, std::vector<CookieMonster::CanonicalCookie*> cookies); - ~LoadedCallbackTask(); void Run() { loaded_callback_.Run(cookies_); } private: + friend class base::RefCountedThreadSafe<LoadedCallbackTask>; + ~LoadedCallbackTask(); + LoadedCallback loaded_callback_; std::vector<CookieMonster::CanonicalCookie*> cookies_; @@ -72,7 +74,6 @@ class MockPersistentCookieStore typedef std::vector<CookieStoreCommand> CommandList; MockPersistentCookieStore(); - virtual ~MockPersistentCookieStore(); void SetLoadExpectation( bool return_value, @@ -100,6 +101,9 @@ class MockPersistentCookieStore // No files are created so nothing to clear either virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; + protected: + virtual ~MockPersistentCookieStore(); + private: CommandList commands_; @@ -157,7 +161,6 @@ class MockSimplePersistentCookieStore : public CookieMonster::PersistentCookieStore { public: MockSimplePersistentCookieStore(); - virtual ~MockSimplePersistentCookieStore(); virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; @@ -177,6 +180,9 @@ class MockSimplePersistentCookieStore virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE; + protected: + virtual ~MockSimplePersistentCookieStore(); + private: typedef std::map<int64, CookieMonster::CanonicalCookie> CanonicalCookieMap; diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index a6b59d0..d2706a5 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc @@ -45,6 +45,9 @@ class NewMockPersistentCookieStore MOCK_METHOD1(DeleteCookie, void(const CookieMonster::CanonicalCookie& cc)); MOCK_METHOD1(SetClearLocalStateOnExit, void(bool clear_local_state)); MOCK_METHOD1(Flush, void(const base::Closure& callback)); + + private: + virtual ~NewMockPersistentCookieStore() {} }; const char* kTopLevelDomainPlus1 = "http://www.harvard.edu"; @@ -2232,6 +2235,8 @@ class FlushablePersistentStore : public CookieMonster::PersistentCookieStore { } private: + virtual ~FlushablePersistentStore() {} + volatile int flush_count_; }; @@ -2250,6 +2255,8 @@ class CallbackCounter : public base::RefCountedThreadSafe<CallbackCounter> { private: friend class base::RefCountedThreadSafe<CallbackCounter>; + ~CallbackCounter() {} + volatile int callback_count_; }; diff --git a/net/disk_cache/net_log_parameters.cc b/net/disk_cache/net_log_parameters.cc index 76d79d7..3a309f9 100644 --- a/net/disk_cache/net_log_parameters.cc +++ b/net/disk_cache/net_log_parameters.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -12,8 +12,10 @@ namespace disk_cache { EntryCreationParameters::EntryCreationParameters( - const std::string& key, bool created) - : key_(key), created_(created) { + const std::string& key, + bool created) + : key_(key), + created_(created) { } Value* EntryCreationParameters::ToValue() const { @@ -23,9 +25,17 @@ Value* EntryCreationParameters::ToValue() const { return dict; } +EntryCreationParameters::~EntryCreationParameters() {} + ReadWriteDataParameters::ReadWriteDataParameters( - int index, int offset, int buf_len, bool truncate) - : index_(index), offset_(offset), buf_len_(buf_len), truncate_(truncate) { + int index, + int offset, + int buf_len, + bool truncate) + : index_(index), + offset_(offset), + buf_len_(buf_len), + truncate_(truncate) { } Value* ReadWriteDataParameters::ToValue() const { @@ -38,6 +48,7 @@ Value* ReadWriteDataParameters::ToValue() const { return dict; } +ReadWriteDataParameters::~ReadWriteDataParameters() {} // NetLog parameters logged when non-sparse reads and writes complete. ReadWriteCompleteParameters::ReadWriteCompleteParameters(int bytes_copied) @@ -55,9 +66,13 @@ Value* ReadWriteCompleteParameters::ToValue() const { return dict; } +ReadWriteCompleteParameters::~ReadWriteCompleteParameters() {} + SparseOperationParameters::SparseOperationParameters( - int64 offset, int buff_len) - : offset_(offset), buff_len_(buff_len) { + int64 offset, + int buff_len) + : offset_(offset), + buff_len_(buff_len) { } Value* SparseOperationParameters::ToValue() const { @@ -69,9 +84,13 @@ Value* SparseOperationParameters::ToValue() const { return dict; } +SparseOperationParameters::~SparseOperationParameters() {} + SparseReadWriteParameters::SparseReadWriteParameters( - const net::NetLog::Source& source, int child_len) - : source_(source), child_len_(child_len) { + const net::NetLog::Source& source, + int child_len) + : source_(source), + child_len_(child_len) { } Value* SparseReadWriteParameters::ToValue() const { @@ -81,9 +100,13 @@ Value* SparseReadWriteParameters::ToValue() const { return dict; } +SparseReadWriteParameters::~SparseReadWriteParameters() {} + GetAvailableRangeResultParameters::GetAvailableRangeResultParameters( - int64 start, int result) - : start_(start), result_(result) { + int64 start, + int result) + : start_(start), + result_(result) { } Value* GetAvailableRangeResultParameters::ToValue() const { @@ -97,4 +120,6 @@ Value* GetAvailableRangeResultParameters::ToValue() const { return dict; } +GetAvailableRangeResultParameters::~GetAvailableRangeResultParameters() {} + } // namespace disk_cache diff --git a/net/disk_cache/net_log_parameters.h b/net/disk_cache/net_log_parameters.h index d0b0c29..4e6b8fe 100644 --- a/net/disk_cache/net_log_parameters.h +++ b/net/disk_cache/net_log_parameters.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -21,6 +21,9 @@ class EntryCreationParameters : public net::NetLog::EventParameters { EntryCreationParameters(const std::string& key, bool created); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~EntryCreationParameters(); + private: const std::string key_; const bool created_; @@ -35,6 +38,9 @@ class ReadWriteDataParameters : public net::NetLog::EventParameters { ReadWriteDataParameters(int index, int offset, int buf_len, bool truncate); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~ReadWriteDataParameters(); + private: const int index_; const int offset_; @@ -53,6 +59,9 @@ class ReadWriteCompleteParameters : public net::NetLog::EventParameters { explicit ReadWriteCompleteParameters(int bytes_copied); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~ReadWriteCompleteParameters(); + private: const int bytes_copied_; @@ -65,6 +74,9 @@ class SparseOperationParameters : public net::NetLog::EventParameters { SparseOperationParameters(int64 offset, int buff_len); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~SparseOperationParameters(); + private: const int64 offset_; const int buff_len_; @@ -77,6 +89,9 @@ class SparseReadWriteParameters : public net::NetLog::EventParameters { SparseReadWriteParameters(const net::NetLog::Source& source, int child_len); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~SparseReadWriteParameters(); + private: const net::NetLog::Source source_; const int child_len_; @@ -89,6 +104,9 @@ class GetAvailableRangeResultParameters : public net::NetLog::EventParameters { GetAvailableRangeResultParameters(int64 start, int result); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~GetAvailableRangeResultParameters(); + private: const int64 start_; const int result_; diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index dd7b659..ba75302 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc @@ -63,6 +63,9 @@ class StartParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~StartParameters() {} + private: const std::string hostname_; const uint16 qtype_; @@ -81,6 +84,9 @@ class ResponseParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~ResponseParameters() {} + private: const int rcode_; const int answer_count_; diff --git a/net/http/http_pipelined_connection_impl.cc b/net/http/http_pipelined_connection_impl.cc index 8e87a89..fe55598 100644 --- a/net/http/http_pipelined_connection_impl.cc +++ b/net/http/http_pipelined_connection_impl.cc @@ -38,6 +38,9 @@ class ReceivedHeadersParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~ReceivedHeadersParameters() {} + private: const NetLog::Source source_; const std::string feedback_; @@ -55,6 +58,9 @@ class StreamClosedParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~StreamClosedParameters() {} + private: const NetLog::Source source_; const bool not_reusable_; diff --git a/net/http/http_pipelined_connection_impl_unittest.cc b/net/http/http_pipelined_connection_impl_unittest.cc index 64b97cc..819b47a 100644 --- a/net/http/http_pipelined_connection_impl_unittest.cc +++ b/net/http/http_pipelined_connection_impl_unittest.cc @@ -27,6 +27,7 @@ namespace net { class DummySocketParams : public base::RefCounted<DummySocketParams> { private: friend class base::RefCounted<DummySocketParams>; + ~DummySocketParams() {} }; REGISTER_SOCKET_PARAMS_FOR_POOL(MockTransportClientSocketPool, diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index bc4af30..b236b5e 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc @@ -51,10 +51,14 @@ class HttpStreamJobParameters : public NetLog::EventParameters { virtual Value* ToValue() const; + protected: + virtual ~HttpStreamJobParameters() {} + private: HttpStreamJobParameters(const GURL& original_url, const GURL& url) : original_url_(original_url.GetOrigin().spec()), - url_(url.GetOrigin().spec()) {} + url_(url.GetOrigin().spec()) { + } const std::string original_url_; const std::string url_; @@ -80,13 +84,17 @@ class HttpStreamProtoParameters : public NetLog::EventParameters { virtual Value* ToValue() const; + protected: + virtual ~HttpStreamProtoParameters() {} + private: HttpStreamProtoParameters(const SSLClientSocket::NextProtoStatus status, const std::string& proto, const std::string& server_protos) : status_(status), proto_(proto), - server_protos_(server_protos) {} + server_protos_(server_protos) { + } const SSLClientSocket::NextProtoStatus status_; const std::string proto_; diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index e971f6c..e0a1bdd 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -200,6 +200,9 @@ class MultiThreadedProxyResolver::SetPacScriptJob base::Bind(&SetPacScriptJob::RequestComplete, this, rv)); } + protected: + virtual ~SetPacScriptJob() {} + private: // Runs the completion callback on the origin thread. void RequestComplete(int result_code) { @@ -266,6 +269,9 @@ class MultiThreadedProxyResolver::GetProxyForURLJob base::Bind(&GetProxyForURLJob::QueryComplete, this, rv)); } + protected: + virtual ~GetProxyForURLJob() {} + private: // Runs the completion callback on the origin thread. void QueryComplete(int result_code) { diff --git a/net/proxy/polling_proxy_config_service.cc b/net/proxy/polling_proxy_config_service.cc index 97fcda9..a03422a 100644 --- a/net/proxy/polling_proxy_config_service.cc +++ b/net/proxy/polling_proxy_config_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -97,6 +97,9 @@ class PollingProxyConfigService::Core } private: + friend class base::RefCountedThreadSafe<Core>; + ~Core() {} + void PollOnWorkerThread(GetConfigFunction func) { ProxyConfig config; func(&config); diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index a1055ff..a3b2f2b 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -179,6 +179,9 @@ class ProxyConfigServiceMac::Helper } private: + friend class base::RefCountedThreadSafe<Helper>; + ~Helper() {} + ProxyConfigServiceMac* parent_; }; diff --git a/net/proxy/proxy_resolver_js_bindings.cc b/net/proxy/proxy_resolver_js_bindings.cc index 08b84ac..48dab35 100644 --- a/net/proxy/proxy_resolver_js_bindings.cc +++ b/net/proxy/proxy_resolver_js_bindings.cc @@ -43,6 +43,9 @@ class ErrorNetlogParams : public NetLog::EventParameters { return dict; } + protected: + virtual ~ErrorNetlogParams() {} + private: const int line_number_; const string16 message_; @@ -53,8 +56,7 @@ class ErrorNetlogParams : public NetLog::EventParameters { // Event parameters for a PAC alert(). class AlertNetlogParams : public NetLog::EventParameters { public: - explicit AlertNetlogParams(const string16& message) : message_(message) { - } + explicit AlertNetlogParams(const string16& message) : message_(message) {} virtual Value* ToValue() const OVERRIDE { DictionaryValue* dict = new DictionaryValue(); @@ -62,6 +64,9 @@ class AlertNetlogParams : public NetLog::EventParameters { return dict; } + protected: + virtual ~AlertNetlogParams() {} + private: const string16 message_; diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc index 23fee76..03bda52 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -558,6 +558,9 @@ class AsyncFailDhcpFetcher } private: + friend class base::RefCountedThreadSafe<AsyncFailDhcpFetcher>; + ~AsyncFailDhcpFetcher() {} + GURL dummy_gurl_; CompletionCallback callback_; }; diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 72b4555..1c92033 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -348,6 +348,9 @@ class ProxyConfigChangedNetLogParam : public NetLog::EventParameters { return dict; } + protected: + virtual ~ProxyConfigChangedNetLogParam() {} + private: const ProxyConfig old_config_; const ProxyConfig new_config_; @@ -374,6 +377,9 @@ class BadProxyListNetLogParam : public NetLog::EventParameters { return dict; } + protected: + virtual ~BadProxyListNetLogParam() {} + private: std::vector<std::string> proxy_list_; DISALLOW_COPY_AND_ASSIGN(BadProxyListNetLogParam); diff --git a/net/proxy/sync_host_resolver_bridge.cc b/net/proxy/sync_host_resolver_bridge.cc index a0261aa..9f55524 100644 --- a/net/proxy/sync_host_resolver_bridge.cc +++ b/net/proxy/sync_host_resolver_bridge.cc @@ -37,6 +37,7 @@ class SyncHostResolverBridge::Core private: friend class base::RefCountedThreadSafe<SyncHostResolverBridge::Core>; + ~Core() {} bool HasShutdownLocked() const { return has_shutdown_; diff --git a/net/server/http_server.cc b/net/server/http_server.cc index ad1fa6e..c9d8ac75 100644 --- a/net/server/http_server.cc +++ b/net/server/http_server.cc @@ -24,12 +24,24 @@ HttpServer::HttpServer(const std::string& host, server_ = TCPListenSocket::CreateAndListen(host, port, this); } -HttpServer::~HttpServer() { - IdToConnectionMap copy = id_to_connection_; - for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it) - delete it->second; +void HttpServer::AcceptWebSocket( + int connection_id, + const HttpServerRequestInfo& request) { + HttpConnection* connection = FindConnection(connection_id); + if (connection == NULL) + return; - server_ = NULL; + DCHECK(connection->web_socket_.get()); + connection->web_socket_->Accept(request); +} + +void HttpServer::SendOverWebSocket(int connection_id, + const std::string& data) { + HttpConnection* connection = FindConnection(connection_id); + if (connection == NULL) + return; + DCHECK(connection->web_socket_.get()); + connection->web_socket_->Send(data); } void HttpServer::Send(int connection_id, const std::string& data) { @@ -81,6 +93,77 @@ void HttpServer::Close(int connection_id) DidClose(connection->socket_); } +void HttpServer::DidAccept(ListenSocket* server, + ListenSocket* socket) { + HttpConnection* connection = new HttpConnection(this, socket); + id_to_connection_[connection->id()] = connection; + socket_to_connection_[socket] = connection; +} + +void HttpServer::DidRead(ListenSocket* socket, + const char* data, + int len) { + HttpConnection* connection = FindConnection(socket); + DCHECK(connection != NULL); + if (connection == NULL) + return; + + connection->recv_data_.append(data, len); + while (connection->recv_data_.length()) { + if (connection->web_socket_.get()) { + std::string message; + WebSocket::ParseResult result = connection->web_socket_->Read(&message); + if (result == WebSocket::FRAME_INCOMPLETE) + break; + + if (result == WebSocket::FRAME_CLOSE || + result == WebSocket::FRAME_ERROR) { + Close(connection->id()); + break; + } + delegate_->OnWebSocketMessage(connection->id(), message); + continue; + } + + HttpServerRequestInfo request; + size_t pos = 0; + if (!ParseHeaders(connection, &request, &pos)) + break; + + std::string connection_header = request.GetHeaderValue("Connection"); + if (connection_header == "Upgrade") { + connection->web_socket_.reset(WebSocket::CreateWebSocket(connection, + request, + &pos)); + + if (!connection->web_socket_.get()) // Not enought data was received. + break; + delegate_->OnWebSocketRequest(connection->id(), request); + connection->Shift(pos); + continue; + } + // Request body is not supported. It is always empty. + delegate_->OnHttpRequest(connection->id(), request); + connection->Shift(pos); + } +} + +void HttpServer::DidClose(ListenSocket* socket) { + HttpConnection* connection = FindConnection(socket); + DCHECK(connection != NULL); + id_to_connection_.erase(connection->id()); + socket_to_connection_.erase(connection->socket_); + delete connection; +} + +HttpServer::~HttpServer() { + IdToConnectionMap copy = id_to_connection_; + for (IdToConnectionMap::iterator it = copy.begin(); it != copy.end(); ++it) + delete it->second; + + server_ = NULL; +} + // // HTTP Request Parser // This HTTP request parser uses a simple state machine to quickly parse @@ -212,69 +295,6 @@ bool HttpServer::ParseHeaders(HttpConnection* connection, return false; } -void HttpServer::DidAccept(ListenSocket* server, - ListenSocket* socket) { - HttpConnection* connection = new HttpConnection(this, socket); - id_to_connection_[connection->id()] = connection; - socket_to_connection_[socket] = connection; -} - -void HttpServer::DidRead(ListenSocket* socket, - const char* data, - int len) { - HttpConnection* connection = FindConnection(socket); - DCHECK(connection != NULL); - if (connection == NULL) - return; - - connection->recv_data_.append(data, len); - while (connection->recv_data_.length()) { - if (connection->web_socket_.get()) { - std::string message; - WebSocket::ParseResult result = connection->web_socket_->Read(&message); - if (result == WebSocket::FRAME_INCOMPLETE) - break; - - if (result == WebSocket::FRAME_CLOSE || - result == WebSocket::FRAME_ERROR) { - Close(connection->id()); - break; - } - delegate_->OnWebSocketMessage(connection->id(), message); - continue; - } - - HttpServerRequestInfo request; - size_t pos = 0; - if (!ParseHeaders(connection, &request, &pos)) - break; - - std::string connection_header = request.GetHeaderValue("Connection"); - if (connection_header == "Upgrade") { - connection->web_socket_.reset(WebSocket::CreateWebSocket(connection, - request, - &pos)); - - if (!connection->web_socket_.get()) // Not enought data was received. - break; - delegate_->OnWebSocketRequest(connection->id(), request); - connection->Shift(pos); - continue; - } - // Request body is not supported. It is always empty. - delegate_->OnHttpRequest(connection->id(), request); - connection->Shift(pos); - } -} - -void HttpServer::DidClose(ListenSocket* socket) { - HttpConnection* connection = FindConnection(socket); - DCHECK(connection != NULL); - id_to_connection_.erase(connection->id()); - socket_to_connection_.erase(connection->socket_); - delete connection; -} - HttpConnection* HttpServer::FindConnection(int connection_id) { IdToConnectionMap::iterator it = id_to_connection_.find(connection_id); if (it == id_to_connection_.end()) @@ -289,24 +309,4 @@ HttpConnection* HttpServer::FindConnection(ListenSocket* socket) { return it->second; } -void HttpServer::AcceptWebSocket( - int connection_id, - const HttpServerRequestInfo& request) { - HttpConnection* connection = FindConnection(connection_id); - if (connection == NULL) - return; - - DCHECK(connection->web_socket_.get()); - connection->web_socket_->Accept(request); -} - -void HttpServer::SendOverWebSocket(int connection_id, - const std::string& data) { - HttpConnection* connection = FindConnection(connection_id); - if (connection == NULL) - return; - DCHECK(connection->web_socket_.get()); - connection->web_socket_->Send(data); -} - } // namespace net diff --git a/net/server/http_server.h b/net/server/http_server.h index 589d887..526558e 100644 --- a/net/server/http_server.h +++ b/net/server/http_server.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -34,12 +34,12 @@ class HttpServer : public ListenSocket::ListenSocketDelegate, const std::string& data) = 0; virtual void OnClose(int connection_id) = 0; + protected: virtual ~Delegate() {} }; HttpServer(const std::string& host, int port, HttpServer::Delegate* del); - virtual ~HttpServer(); void AcceptWebSocket(int connection_id, const HttpServerRequestInfo& request); @@ -53,10 +53,6 @@ class HttpServer : public ListenSocket::ListenSocketDelegate, void Send500(int connection_id, const std::string& message); void Close(int connection_id); -private: - friend class base::RefCountedThreadSafe<HttpServer>; - friend class HttpConnection; - // ListenSocketDelegate virtual void DidAccept(ListenSocket* server, ListenSocket* socket) OVERRIDE; virtual void DidRead(ListenSocket* socket, @@ -64,6 +60,13 @@ private: int len) OVERRIDE; virtual void DidClose(ListenSocket* socket) OVERRIDE; + protected: + virtual ~HttpServer(); + + private: + friend class base::RefCountedThreadSafe<HttpServer>; + friend class HttpConnection; + // Expects the raw data to be stored in recv_data_. If parsing is successful, // will remove the data parsed from recv_data_, leaving only the unused // recv data. diff --git a/net/socket/nss_ssl_util.cc b/net/socket/nss_ssl_util.cc index fc94004..4f6b3ac 100644 --- a/net/socket/nss_ssl_util.cc +++ b/net/socket/nss_ssl_util.cc @@ -249,6 +249,9 @@ class SSLFailedNSSFunctionParams : public NetLog::EventParameters { return dict; } + protected: + virtual ~SSLFailedNSSFunctionParams() {} + private: const std::string function_; const std::string param_; diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 0e9ea78..929514f 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -424,9 +424,8 @@ DeterministicSocketData::DeterministicSocketData(MockRead* reads, current_write_(), stopping_sequence_number_(0), stopped_(false), - print_debug_(false) {} - -DeterministicSocketData::~DeterministicSocketData() {} + print_debug_(false) { +} void DeterministicSocketData::Run() { SetStopped(false); @@ -554,6 +553,8 @@ void DeterministicSocketData::Reset() { NOTREACHED(); } +DeterministicSocketData::~DeterministicSocketData() {} + void DeterministicSocketData::InvokeCallbacks() { if (socket_ && socket_->write_pending() && (current_write().sequence_number == sequence_number())) { diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 350e0b4..d54e2ac 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -433,14 +433,14 @@ class DeterministicMockTCPClientSocket; // // For examples of how to use this class, see: // deterministic_socket_data_unittests.cc -class DeterministicSocketData : public StaticSocketDataProvider, - public base::RefCounted<DeterministicSocketData> { +class DeterministicSocketData + : public StaticSocketDataProvider, + public base::RefCounted<DeterministicSocketData> { public: // |reads| the list of MockRead completions. // |writes| the list of MockWrite completions. DeterministicSocketData(MockRead* reads, size_t reads_count, MockWrite* writes, size_t writes_count); - virtual ~DeterministicSocketData(); // Consume all the data up to the give stop point (via SetStop()). void Run(); @@ -475,7 +475,12 @@ class DeterministicSocketData : public StaticSocketDataProvider, virtual void Reset() OVERRIDE; virtual void CompleteRead() OVERRIDE {} + protected: + virtual ~DeterministicSocketData(); + private: + friend class base::RefCounted<DeterministicSocketData>; + // Invoke the read and write callbacks, if the timing is appropriate. void InvokeCallbacks(); @@ -496,8 +501,7 @@ class DeterministicSocketData : public StaticSocketDataProvider, template<typename T> class SocketDataProviderArray { public: - SocketDataProviderArray() : next_index_(0) { - } + SocketDataProviderArray() : next_index_(0) {} T* GetNext() { DCHECK_LT(next_index_, data_providers_.size()); diff --git a/net/socket/ssl_error_params.cc b/net/socket/ssl_error_params.cc index c77cbec..fc2a0f3 100644 --- a/net/socket/ssl_error_params.cc +++ b/net/socket/ssl_error_params.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -9,9 +9,9 @@ namespace net { SSLErrorParams::SSLErrorParams(int net_error, int ssl_lib_error) - : net_error_(net_error), ssl_lib_error_(ssl_lib_error) {} - -SSLErrorParams::~SSLErrorParams() {} + : net_error_(net_error), + ssl_lib_error_(ssl_lib_error) { +} Value* SSLErrorParams::ToValue() const { DictionaryValue* dict = new DictionaryValue(); @@ -21,4 +21,6 @@ Value* SSLErrorParams::ToValue() const { return dict; } +SSLErrorParams::~SSLErrorParams() {} + } // namespace net diff --git a/net/socket/ssl_error_params.h b/net/socket/ssl_error_params.h index 434d8bc..a623b3fd 100644 --- a/net/socket/ssl_error_params.h +++ b/net/socket/ssl_error_params.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,10 +14,12 @@ namespace net { class SSLErrorParams : public NetLog::EventParameters { public: SSLErrorParams(int net_error, int ssl_lib_error); - virtual ~SSLErrorParams(); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~SSLErrorParams(); + private: const int net_error_; const int ssl_lib_error_; diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 7f39b17..7c7e426 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -49,9 +49,6 @@ NetLogSpdySynParameter::NetLogSpdySynParameter( associated_stream_(associated_stream) { } -NetLogSpdySynParameter::~NetLogSpdySynParameter() { -} - Value* NetLogSpdySynParameter::ToValue() const { DictionaryValue* dict = new DictionaryValue(); ListValue* headers_list = new ListValue(); @@ -68,6 +65,8 @@ Value* NetLogSpdySynParameter::ToValue() const { return dict; } +NetLogSpdySynParameter::~NetLogSpdySynParameter() {} + NetLogSpdyCredentialParameter::NetLogSpdyCredentialParameter( size_t slot, const std::string& origin) @@ -75,9 +74,6 @@ NetLogSpdyCredentialParameter::NetLogSpdyCredentialParameter( origin_(origin) { } -NetLogSpdyCredentialParameter::~NetLogSpdyCredentialParameter() { -} - Value* NetLogSpdyCredentialParameter::ToValue() const { DictionaryValue* dict = new DictionaryValue(); dict->SetInteger("slot", slot_); @@ -85,13 +81,13 @@ Value* NetLogSpdyCredentialParameter::ToValue() const { return dict; } +NetLogSpdyCredentialParameter::~NetLogSpdyCredentialParameter() {} + NetLogSpdySessionCloseParameter::NetLogSpdySessionCloseParameter( int status, const std::string& description) : status_(status), - description_(description) {} - -NetLogSpdySessionCloseParameter::~NetLogSpdySessionCloseParameter() { + description_(description) { } Value* NetLogSpdySessionCloseParameter::ToValue() const { @@ -101,6 +97,8 @@ Value* NetLogSpdySessionCloseParameter::ToValue() const { return dict; } +NetLogSpdySessionCloseParameter::~NetLogSpdySessionCloseParameter() {} + namespace { const int kReadBufferSize = 8 * 1024; @@ -112,13 +110,17 @@ class NetLogSpdySessionParameter : public NetLog::EventParameters { public: NetLogSpdySessionParameter(const HostPortProxyPair& host_pair) : host_pair_(host_pair) {} + virtual Value* ToValue() const { DictionaryValue* dict = new DictionaryValue(); dict->Set("host", new StringValue(host_pair_.first.ToString())); dict->Set("proxy", new StringValue(host_pair_.second.ToPacString())); return dict; } + private: + virtual ~NetLogSpdySessionParameter() {} + const HostPortProxyPair host_pair_; DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionParameter); }; @@ -142,7 +144,8 @@ class NetLogSpdySettingParameter : public NetLog::EventParameters { } private: - ~NetLogSpdySettingParameter() {} + virtual ~NetLogSpdySettingParameter() {} + const SpdySettingsIds id_; const SpdySettingsFlags flags_; const uint32 value_; diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index d3d5ec3..787cb0e 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -703,9 +703,10 @@ class NetLogSpdySynParameter : public NetLog::EventParameters { virtual base::Value* ToValue() const OVERRIDE; - private: + protected: virtual ~NetLogSpdySynParameter(); + private: const linked_ptr<SpdyHeaderBlock> headers_; const SpdyControlFlags flags_; const SpdyStreamId id_; @@ -721,9 +722,10 @@ class NetLogSpdyCredentialParameter : public NetLog::EventParameters { virtual base::Value* ToValue() const OVERRIDE; - private: + protected: virtual ~NetLogSpdyCredentialParameter(); + private: const size_t slot_; const std::string origin_; @@ -738,9 +740,10 @@ class NetLogSpdySessionCloseParameter : public NetLog::EventParameters { int status() const { return status_; } virtual base::Value* ToValue() const OVERRIDE; - private: + protected: virtual ~NetLogSpdySessionCloseParameter(); + private: const int status_; const std::string description_; diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index 154cb27..f1ef5b7 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -42,6 +42,7 @@ class NetLogSpdyStreamWindowUpdateParameter : public NetLog::EventParameters { int32 delta, int32 window_size) : stream_id_(stream_id), delta_(delta), window_size_(window_size) {} + virtual Value* ToValue() const { DictionaryValue* dict = new DictionaryValue(); dict->SetInteger("id", static_cast<int>(stream_id_)); @@ -49,7 +50,10 @@ class NetLogSpdyStreamWindowUpdateParameter : public NetLog::EventParameters { dict->SetInteger("window_size", window_size_); return dict; } + private: + virtual ~NetLogSpdyStreamWindowUpdateParameter() {} + const SpdyStreamId stream_id_; const int32 delta_; const int32 window_size_; diff --git a/net/udp/udp_data_transfer_param.cc b/net/udp/udp_data_transfer_param.cc index 808cd8b..cd4da88 100644 --- a/net/udp/udp_data_transfer_param.cc +++ b/net/udp/udp_data_transfer_param.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -20,9 +20,6 @@ UDPDataTransferNetLogParam::UDPDataTransferNetLogParam( address_.reset(new IPEndPoint(*address)); } -UDPDataTransferNetLogParam::~UDPDataTransferNetLogParam() { -} - Value* UDPDataTransferNetLogParam::ToValue() const { DictionaryValue* dict = new DictionaryValue(); dict->SetInteger("byte_count", byte_count_); @@ -33,4 +30,6 @@ Value* UDPDataTransferNetLogParam::ToValue() const { return dict; } +UDPDataTransferNetLogParam::~UDPDataTransferNetLogParam() {} + } // namespace net diff --git a/net/udp/udp_data_transfer_param.h b/net/udp/udp_data_transfer_param.h index 1ef86fd..1cc6561 100644 --- a/net/udp/udp_data_transfer_param.h +++ b/net/udp/udp_data_transfer_param.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,12 +23,16 @@ class UDPDataTransferNetLogParam : public NetLog::EventParameters { public: // |bytes| are only logged when |log_bytes| is non-NULL. // |address| may be NULL. - UDPDataTransferNetLogParam(int byte_count, const char* bytes, bool log_bytes, + UDPDataTransferNetLogParam(int byte_count, + const char* bytes, + bool log_bytes, const IPEndPoint* address); - virtual ~UDPDataTransferNetLogParam(); virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~UDPDataTransferNetLogParam(); + private: const int byte_count_; const std::string hex_encoded_bytes_; diff --git a/net/url_request/url_request_job_factory_unittest.cc b/net/url_request/url_request_job_factory_unittest.cc index 509df08..1273256 100644 --- a/net/url_request/url_request_job_factory_unittest.cc +++ b/net/url_request/url_request_job_factory_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -21,7 +21,7 @@ class MockURLRequestJob : public URLRequestJob { status_(status), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} - virtual void Start() { + virtual void Start() OVERRIDE { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. MessageLoop::current()->PostTask( @@ -30,6 +30,9 @@ class MockURLRequestJob : public URLRequestJob { weak_factory_.GetWeakPtr())); } + protected: + virtual ~MockURLRequestJob() {} + private: void StartAsync() { SetStatus(status_); @@ -42,7 +45,7 @@ class MockURLRequestJob : public URLRequestJob { class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler { public: - virtual URLRequestJob* MaybeCreateJob(URLRequest* request) const { + virtual URLRequestJob* MaybeCreateJob(URLRequest* request) const OVERRIDE { return new MockURLRequestJob( request, URLRequestStatus(URLRequestStatus::SUCCESS, OK)); } @@ -52,9 +55,10 @@ class DummyInterceptor : public URLRequestJobFactory::Interceptor { public: DummyInterceptor() : did_intercept_(false), - handle_all_protocols_(false) { } + handle_all_protocols_(false) { + } - virtual URLRequestJob* MaybeIntercept(URLRequest* request) const { + virtual URLRequestJob* MaybeIntercept(URLRequest* request) const OVERRIDE { did_intercept_ = true; return new MockURLRequestJob( request, @@ -63,17 +67,17 @@ class DummyInterceptor : public URLRequestJobFactory::Interceptor { virtual URLRequestJob* MaybeInterceptRedirect( const GURL& /* location */, - URLRequest* /* request */) const { + URLRequest* /* request */) const OVERRIDE { return NULL; } virtual URLRequestJob* MaybeInterceptResponse( - URLRequest* /* request */) const { + URLRequest* /* request */) const OVERRIDE { return NULL; } virtual bool WillHandleProtocol( - const std::string& /* protocol */) const { + const std::string& /* protocol */) const OVERRIDE { return handle_all_protocols_; } diff --git a/net/url_request/url_request_netlog_params.cc b/net/url_request/url_request_netlog_params.cc index 42076bc..29143ba 100644 --- a/net/url_request/url_request_netlog_params.cc +++ b/net/url_request/url_request_netlog_params.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -28,4 +28,6 @@ Value* URLRequestStartEventParameters::ToValue() const { return dict; } +URLRequestStartEventParameters::~URLRequestStartEventParameters() {} + } // namespace net diff --git a/net/url_request/url_request_netlog_params.h b/net/url_request/url_request_netlog_params.h index 9f0d574..d084f24 100644 --- a/net/url_request/url_request_netlog_params.h +++ b/net/url_request/url_request_netlog_params.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -35,6 +35,9 @@ class NET_EXPORT URLRequestStartEventParameters virtual base::Value* ToValue() const OVERRIDE; + protected: + virtual ~URLRequestStartEventParameters(); + private: const GURL url_; const std::string method_; diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc index ece2b8b..60c6154 100644 --- a/net/url_request/url_request_throttler_entry.cc +++ b/net/url_request/url_request_throttler_entry.cc @@ -68,6 +68,9 @@ class RejectedRequestParameters : public NetLog::EventParameters { return dict; } + protected: + virtual ~RejectedRequestParameters() {} + private: std::string url_id_; int num_failures_; diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc index 5ee1746..256d343 100644 --- a/net/url_request/url_request_throttler_simulation_unittest.cc +++ b/net/url_request/url_request_throttler_simulation_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -299,7 +299,6 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { : URLRequestThrottlerEntry(manager, ""), mock_backoff_entry_(&backoff_policy_) { } - virtual ~MockURLRequestThrottlerEntry() {} virtual const BackoffEntry* GetBackoffEntry() const OVERRIDE { return &mock_backoff_entry_; @@ -322,6 +321,9 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { return fake_now_; } + protected: + virtual ~MockURLRequestThrottlerEntry() {} + private: TimeTicks fake_now_; MockBackoffEntry mock_backoff_entry_; diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc index 88243db..11a1f76 100644 --- a/net/url_request/url_request_throttler_unittest.cc +++ b/net/url_request/url_request_throttler_unittest.cc @@ -49,7 +49,6 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { set_exponential_backoff_release_time(exponential_backoff_release_time); set_sliding_window_release_time(sliding_window_release_time); } - virtual ~MockURLRequestThrottlerEntry() {} void InitPolicy() { // Some tests become flaky if we have jitter. @@ -101,6 +100,9 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { TimeTicks fake_time_now_; MockBackoffEntry mock_backoff_entry_; + + protected: + virtual ~MockURLRequestThrottlerEntry() {} }; class MockURLRequestThrottlerManager : public URLRequestThrottlerManager { diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 7126fa3..d53c01c 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -1418,12 +1418,16 @@ class TestSSLConfigService : public SSLConfigService { online_rev_checking_(online_rev_checking) { } - virtual void GetSSLConfig(SSLConfig* config) { + // SSLConfigService: + virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { *config = SSLConfig(); config->rev_checking_enabled = online_rev_checking_; config->verify_ev_cert = ev_enabled_; } + protected: + virtual ~TestSSLConfigService() {} + private: const bool ev_enabled_; const bool online_rev_checking_; diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc index a8c0822..dbb813d 100644 --- a/net/url_request/view_cache_helper_unittest.cc +++ b/net/url_request/view_cache_helper_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,6 +23,9 @@ class TestURLRequestContext : public URLRequestContext { // Gets a pointer to the cache backend. disk_cache::Backend* GetBackend(); + protected: + virtual ~TestURLRequestContext() {} + private: HttpCache cache_; }; diff --git a/net/websockets/websocket_job_spdy2_unittest.cc b/net/websockets/websocket_job_spdy2_unittest.cc index bfe8ca7..ebcc72f 100644 --- a/net/websockets/websocket_job_spdy2_unittest.cc +++ b/net/websockets/websocket_job_spdy2_unittest.cc @@ -44,7 +44,6 @@ class MockSocketStream : public net::SocketStream { public: MockSocketStream(const GURL& url, net::SocketStream::Delegate* delegate) : SocketStream(url, delegate) {} - virtual ~MockSocketStream() {} virtual void Connect() OVERRIDE {} virtual bool SendData(const char* data, int len) OVERRIDE { @@ -65,6 +64,9 @@ class MockSocketStream : public net::SocketStream { return sent_data_; } + protected: + virtual ~MockSocketStream() {} + private: std::string sent_data_; }; @@ -94,24 +96,26 @@ class MockSocketStreamDelegate : public net::SocketStream::Delegate { on_close_ = callback; } - virtual int OnStartOpenConnection(net::SocketStream* socket, - const net::CompletionCallback& callback) { + virtual int OnStartOpenConnection( + net::SocketStream* socket, + const net::CompletionCallback& callback) OVERRIDE { if (!on_start_open_connection_.is_null()) on_start_open_connection_.Run(); return net::OK; } virtual void OnConnected(net::SocketStream* socket, - int max_pending_send_allowed) { + int max_pending_send_allowed) OVERRIDE { if (!on_connected_.is_null()) on_connected_.Run(); } - virtual void OnSentData(net::SocketStream* socket, int amount_sent) { + virtual void OnSentData(net::SocketStream* socket, + int amount_sent) OVERRIDE { amount_sent_ += amount_sent; if (!on_sent_data_.is_null()) on_sent_data_.Run(); } virtual void OnReceivedData(net::SocketStream* socket, - const char* data, int len) { + const char* data, int len) OVERRIDE { received_data_ += std::string(data, len); if (!on_received_data_.is_null()) on_received_data_.Run(); @@ -120,13 +124,14 @@ class MockSocketStreamDelegate : public net::SocketStream::Delegate { if (!on_close_.is_null()) on_close_.Run(); } - virtual bool CanGetCookies(net::SocketStream* socket, const GURL& url) { + virtual bool CanGetCookies(net::SocketStream* socket, + const GURL& url) OVERRIDE { return allow_all_cookies_; } virtual bool CanSetCookie(net::SocketStream* request, const GURL& url, const std::string& cookie_line, - net::CookieOptions* options) { + net::CookieOptions* options) OVERRIDE { return allow_all_cookies_; } @@ -151,11 +156,12 @@ class MockCookieStore : public net::CookieStore { std::string cookie_line; net::CookieOptions options; }; + MockCookieStore() {} - virtual bool SetCookieWithOptions(const GURL& url, - const std::string& cookie_line, - const net::CookieOptions& options) { + bool SetCookieWithOptions(const GURL& url, + const std::string& cookie_line, + const net::CookieOptions& options) { Entry entry; entry.url = url; entry.cookie_line = cookie_line; @@ -164,18 +170,8 @@ class MockCookieStore : public net::CookieStore { return true; } - virtual void SetCookieWithOptionsAsync( - const GURL& url, - const std::string& cookie_line, - const net::CookieOptions& options, - const SetCookiesCallback& callback) { - bool result = SetCookieWithOptions(url, cookie_line, options); - if (!callback.is_null()) - callback.Run(result); - } - virtual std::string GetCookiesWithOptions( - const GURL& url, - const net::CookieOptions& options) { + std::string GetCookiesWithOptions(const GURL& url, + const net::CookieOptions& options) { std::string result; for (size_t i = 0; i < entries_.size(); i++) { Entry &entry = entries_[i]; @@ -188,44 +184,51 @@ class MockCookieStore : public net::CookieStore { } return result; } - virtual void GetCookiesWithOptionsAsync( + + // CookieStore: + virtual void SetCookieWithOptionsAsync( const GURL& url, + const std::string& cookie_line, const net::CookieOptions& options, - const GetCookiesCallback& callback) { - if (!callback.is_null()) - callback.Run(GetCookiesWithOptions(url, options)); + const SetCookiesCallback& callback) OVERRIDE { + bool result = SetCookieWithOptions(url, cookie_line, options); + if (!callback.is_null()) + callback.Run(result); } - virtual void GetCookiesWithInfo(const GURL& url, - const net::CookieOptions& options, - std::string* cookie_line, - std::vector<CookieInfo>* cookie_infos) { - ADD_FAILURE(); + + virtual void GetCookiesWithOptionsAsync( + const GURL& url, + const net::CookieOptions& options, + const GetCookiesCallback& callback) OVERRIDE { + if (!callback.is_null()) + callback.Run(GetCookiesWithOptions(url, options)); } + virtual void GetCookiesWithInfoAsync( const GURL& url, const net::CookieOptions& options, - const GetCookieInfoCallback& callback) { - ADD_FAILURE(); - } - virtual void DeleteCookie(const GURL& url, - const std::string& cookie_name) { + const GetCookieInfoCallback& callback) OVERRIDE { ADD_FAILURE(); } + virtual void DeleteCookieAsync(const GURL& url, const std::string& cookie_name, - const base::Closure& callback) { + const base::Closure& callback) OVERRIDE { ADD_FAILURE(); } - virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, - const base::Time& delete_end, - const DeleteCallback& callback) { + + virtual void DeleteAllCreatedBetweenAsync( + const base::Time& delete_begin, + const base::Time& delete_end, + const DeleteCallback& callback) OVERRIDE { ADD_FAILURE(); } - virtual void DeleteSessionCookiesAsync(const DeleteCallback&) { + + virtual void DeleteSessionCookiesAsync(const DeleteCallback&) OVERRIDE { ADD_FAILURE(); } - virtual net::CookieMonster* GetCookieMonster() { return NULL; } + virtual net::CookieMonster* GetCookieMonster() OVERRIDE { return NULL; } const std::vector<Entry>& entries() const { return entries_; } @@ -238,7 +241,10 @@ class MockCookieStore : public net::CookieStore { class MockSSLConfigService : public net::SSLConfigService { public: - virtual void GetSSLConfig(net::SSLConfig* config) {}; + virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE {} + + protected: + virtual ~MockSSLConfigService() {} }; class MockURLRequestContext : public net::URLRequestContext { @@ -252,10 +258,11 @@ class MockURLRequestContext : public net::URLRequestContext { transport_security_state_.EnableHost("upgrademe.com", state); } - private: + protected: friend class base::RefCountedThreadSafe<MockURLRequestContext>; virtual ~MockURLRequestContext() {} + private: net::TransportSecurityState transport_security_state_; }; @@ -295,17 +302,22 @@ class MockHttpTransactionFactory : public net::HttpTransactionFactory { EXPECT_EQ(net::OK, session_->InitializeWithSocket(connection, false, net::OK)); } - virtual int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans) { + + virtual int CreateTransaction( + scoped_ptr<net::HttpTransaction>* trans) OVERRIDE { NOTREACHED(); return net::ERR_UNEXPECTED; } - virtual net::HttpCache* GetCache() { + + virtual net::HttpCache* GetCache() OVERRIDE { NOTREACHED(); return NULL; } - virtual net::HttpNetworkSession* GetSession() { + + virtual net::HttpNetworkSession* GetSession() OVERRIDE { return http_session_.get(); } + private: net::OrderedSocketData* data_; scoped_ptr<SpdySessionDependencies> session_deps_; @@ -321,13 +333,13 @@ namespace net { class WebSocketJobSpdy2Test : public PlatformTest { public: - virtual void SetUp() { + virtual void SetUp() OVERRIDE { SpdySession::set_default_protocol(kProtoSPDY2); stream_type_ = STREAM_INVALID; cookie_store_ = new MockCookieStore; context_ = new MockURLRequestContext(cookie_store_.get()); } - virtual void TearDown() { + virtual void TearDown() OVERRIDE { cookie_store_ = NULL; context_ = NULL; websocket_ = NULL; diff --git a/net/websockets/websocket_job_spdy3_unittest.cc b/net/websockets/websocket_job_spdy3_unittest.cc index 4b7e2a0..6fd4767 100644 --- a/net/websockets/websocket_job_spdy3_unittest.cc +++ b/net/websockets/websocket_job_spdy3_unittest.cc @@ -43,8 +43,8 @@ namespace { class MockSocketStream : public net::SocketStream { public: MockSocketStream(const GURL& url, net::SocketStream::Delegate* delegate) - : SocketStream(url, delegate) {} - virtual ~MockSocketStream() {} + : SocketStream(url, delegate) { + } virtual void Connect() OVERRIDE {} virtual bool SendData(const char* data, int len) OVERRIDE { @@ -65,6 +65,9 @@ class MockSocketStream : public net::SocketStream { return sent_data_; } + protected: + virtual ~MockSocketStream() {} + private: std::string sent_data_; }; @@ -72,7 +75,10 @@ class MockSocketStream : public net::SocketStream { class MockSocketStreamDelegate : public net::SocketStream::Delegate { public: MockSocketStreamDelegate() - : amount_sent_(0), allow_all_cookies_(true) {} + : amount_sent_(0), + allow_all_cookies_(true) { + } + void set_allow_all_cookies(bool allow_all_cookies) { allow_all_cookies_ = allow_all_cookies; } @@ -94,24 +100,26 @@ class MockSocketStreamDelegate : public net::SocketStream::Delegate { on_close_ = callback; } - virtual int OnStartOpenConnection(net::SocketStream* socket, - const net::CompletionCallback& callback) { + virtual int OnStartOpenConnection( + net::SocketStream* socket, + const net::CompletionCallback& callback) OVERRIDE { if (!on_start_open_connection_.is_null()) on_start_open_connection_.Run(); return net::OK; } virtual void OnConnected(net::SocketStream* socket, - int max_pending_send_allowed) { + int max_pending_send_allowed) OVERRIDE { if (!on_connected_.is_null()) on_connected_.Run(); } - virtual void OnSentData(net::SocketStream* socket, int amount_sent) { + virtual void OnSentData(net::SocketStream* socket, + int amount_sent) OVERRIDE { amount_sent_ += amount_sent; if (!on_sent_data_.is_null()) on_sent_data_.Run(); } virtual void OnReceivedData(net::SocketStream* socket, - const char* data, int len) { + const char* data, int len) OVERRIDE { received_data_ += std::string(data, len); if (!on_received_data_.is_null()) on_received_data_.Run(); @@ -120,13 +128,14 @@ class MockSocketStreamDelegate : public net::SocketStream::Delegate { if (!on_close_.is_null()) on_close_.Run(); } - virtual bool CanGetCookies(net::SocketStream* socket, const GURL& url) { + virtual bool CanGetCookies(net::SocketStream* socket, + const GURL& url) OVERRIDE { return allow_all_cookies_; } virtual bool CanSetCookie(net::SocketStream* request, const GURL& url, const std::string& cookie_line, - net::CookieOptions* options) { + net::CookieOptions* options) OVERRIDE { return allow_all_cookies_; } @@ -151,11 +160,12 @@ class MockCookieStore : public net::CookieStore { std::string cookie_line; net::CookieOptions options; }; + MockCookieStore() {} - virtual bool SetCookieWithOptions(const GURL& url, - const std::string& cookie_line, - const net::CookieOptions& options) { + bool SetCookieWithOptions(const GURL& url, + const std::string& cookie_line, + const net::CookieOptions& options) { Entry entry; entry.url = url; entry.cookie_line = cookie_line; @@ -164,18 +174,8 @@ class MockCookieStore : public net::CookieStore { return true; } - virtual void SetCookieWithOptionsAsync( - const GURL& url, - const std::string& cookie_line, - const net::CookieOptions& options, - const SetCookiesCallback& callback) { - bool result = SetCookieWithOptions(url, cookie_line, options); - if (!callback.is_null()) - callback.Run(result); - } - virtual std::string GetCookiesWithOptions( - const GURL& url, - const net::CookieOptions& options) { + std::string GetCookiesWithOptions(const GURL& url, + const net::CookieOptions& options) { std::string result; for (size_t i = 0; i < entries_.size(); i++) { Entry &entry = entries_[i]; @@ -188,44 +188,51 @@ class MockCookieStore : public net::CookieStore { } return result; } - virtual void GetCookiesWithOptionsAsync( + + // CookieStore: + virtual void SetCookieWithOptionsAsync( const GURL& url, + const std::string& cookie_line, const net::CookieOptions& options, - const GetCookiesCallback& callback) { - if (!callback.is_null()) - callback.Run(GetCookiesWithOptions(url, options)); + const SetCookiesCallback& callback) OVERRIDE { + bool result = SetCookieWithOptions(url, cookie_line, options); + if (!callback.is_null()) + callback.Run(result); } - virtual void GetCookiesWithInfo(const GURL& url, - const net::CookieOptions& options, - std::string* cookie_line, - std::vector<CookieInfo>* cookie_infos) { - ADD_FAILURE(); + + virtual void GetCookiesWithOptionsAsync( + const GURL& url, + const net::CookieOptions& options, + const GetCookiesCallback& callback) OVERRIDE { + if (!callback.is_null()) + callback.Run(GetCookiesWithOptions(url, options)); } + virtual void GetCookiesWithInfoAsync( const GURL& url, const net::CookieOptions& options, - const GetCookieInfoCallback& callback) { - ADD_FAILURE(); - } - virtual void DeleteCookie(const GURL& url, - const std::string& cookie_name) { + const GetCookieInfoCallback& callback) OVERRIDE { ADD_FAILURE(); } + virtual void DeleteCookieAsync(const GURL& url, const std::string& cookie_name, - const base::Closure& callback) { + const base::Closure& callback) OVERRIDE { ADD_FAILURE(); } - virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, - const base::Time& delete_end, - const DeleteCallback& callback) { + + virtual void DeleteAllCreatedBetweenAsync( + const base::Time& delete_begin, + const base::Time& delete_end, + const DeleteCallback& callback) OVERRIDE { ADD_FAILURE(); } - virtual void DeleteSessionCookiesAsync(const DeleteCallback&) { + + virtual void DeleteSessionCookiesAsync(const DeleteCallback&) OVERRIDE { ADD_FAILURE(); } - virtual net::CookieMonster* GetCookieMonster() { return NULL; } + virtual net::CookieMonster* GetCookieMonster() OVERRIDE { return NULL; } const std::vector<Entry>& entries() const { return entries_; } @@ -238,7 +245,10 @@ class MockCookieStore : public net::CookieStore { class MockSSLConfigService : public net::SSLConfigService { public: - virtual void GetSSLConfig(net::SSLConfig* config) {}; + virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE {} + + protected: + virtual ~MockSSLConfigService() {} }; class MockURLRequestContext : public net::URLRequestContext { @@ -252,10 +262,11 @@ class MockURLRequestContext : public net::URLRequestContext { transport_security_state_.EnableHost("upgrademe.com", state); } - private: + protected: friend class base::RefCountedThreadSafe<MockURLRequestContext>; virtual ~MockURLRequestContext() {} + private: net::TransportSecurityState transport_security_state_; }; |