Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc

Issue 365583003: [fsp] Remove weak pointers from loggers wherever possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
index a1c9d82a54cf6afa58199ed808299a3d03028150..7f7140c1c40b1cd178942a3aba1a9629fc3a3351 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
@@ -50,21 +50,16 @@ class LoggingDispatchEventImpl {
// Callback invocation logger. Acts as a fileapi end-point.
class CallbackLogger {
public:
- CallbackLogger() : weak_ptr_factory_(this) {}
+ CallbackLogger() {}
virtual ~CallbackLogger() {}
void OnUnmount(base::File::Error result) { events_.push_back(result); }
std::vector<base::File::Error>& events() { return events_; }
- base::WeakPtr<CallbackLogger> GetWeakPtr() {
- return weak_ptr_factory_.GetWeakPtr();
- }
-
private:
std::vector<base::File::Error> events_;
bool dispatch_reply_;
- base::WeakPtrFactory<CallbackLogger> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CallbackLogger);
};
@@ -91,10 +86,10 @@ TEST_F(FileSystemProviderOperationsUnmountTest, Execute) {
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
- Unmount unmount(
- NULL,
- file_system_info_,
- base::Bind(&CallbackLogger::OnUnmount, callback_logger.GetWeakPtr()));
+ Unmount unmount(NULL,
+ file_system_info_,
+ base::Bind(&CallbackLogger::OnUnmount,
+ base::Unretained(&callback_logger)));
unmount.SetDispatchEventImplForTesting(
base::Bind(&LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
@@ -125,10 +120,10 @@ TEST_F(FileSystemProviderOperationsUnmountTest, Execute_NoListener) {
LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
CallbackLogger callback_logger;
- Unmount unmount(
- NULL,
- file_system_info_,
- base::Bind(&CallbackLogger::OnUnmount, callback_logger.GetWeakPtr()));
+ Unmount unmount(NULL,
+ file_system_info_,
+ base::Bind(&CallbackLogger::OnUnmount,
+ base::Unretained(&callback_logger)));
unmount.SetDispatchEventImplForTesting(
base::Bind(&LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
@@ -143,10 +138,10 @@ TEST_F(FileSystemProviderOperationsUnmountTest, OnSuccess) {
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
- Unmount unmount(
- NULL,
- file_system_info_,
- base::Bind(&CallbackLogger::OnUnmount, callback_logger.GetWeakPtr()));
+ Unmount unmount(NULL,
+ file_system_info_,
+ base::Bind(&CallbackLogger::OnUnmount,
+ base::Unretained(&callback_logger)));
unmount.SetDispatchEventImplForTesting(
base::Bind(&LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));
@@ -165,10 +160,10 @@ TEST_F(FileSystemProviderOperationsUnmountTest, OnError) {
LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
CallbackLogger callback_logger;
- Unmount unmount(
- NULL,
- file_system_info_,
- base::Bind(&CallbackLogger::OnUnmount, callback_logger.GetWeakPtr()));
+ Unmount unmount(NULL,
+ file_system_info_,
+ base::Bind(&CallbackLogger::OnUnmount,
+ base::Unretained(&callback_logger)));
unmount.SetDispatchEventImplForTesting(
base::Bind(&LoggingDispatchEventImpl::OnDispatchEventImpl,
base::Unretained(&dispatcher)));

Powered by Google App Engine
This is Rietveld 408576698