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

Unified Diff: webkit/plugins/ppapi/quota_file_io_unittest.cc

Issue 8231004: Remaining cleanup (base::Bind): Replacing FileUtilProxy calls with new callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got it building Created 9 years, 2 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
« base/file_util_proxy.h ('K') | « webkit/plugins/ppapi/quota_file_io.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/quota_file_io_unittest.cc
diff --git a/webkit/plugins/ppapi/quota_file_io_unittest.cc b/webkit/plugins/ppapi/quota_file_io_unittest.cc
index 2b7d5755c25f0af7d7e73b699becca964d53494e..8dc538e0136dfe4eb96f6fb4c43532344130dd75 100644
--- a/webkit/plugins/ppapi/quota_file_io_unittest.cc
+++ b/webkit/plugins/ppapi/quota_file_io_unittest.cc
@@ -8,7 +8,6 @@
#include "base/basictypes.h"
#include "base/bind.h"
-#include "base/memory/scoped_callback_factory.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/platform_file.h"
@@ -86,7 +85,7 @@ class QuotaMockPluginDelegate : public MockPluginDelegate {
class QuotaFileIOTest : public PpapiUnittest {
public:
QuotaFileIOTest()
- : callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
+ : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
virtual void SetUp() OVERRIDE {
PpapiUnittest::SetUp();
@@ -123,14 +122,16 @@ class QuotaFileIOTest : public PpapiUnittest {
void WriteTestBody(bool will_operation) {
// Attempt to write zero bytes.
- EXPECT_FALSE(quota_file_io_->Write(0, "data", 0,
- callback_factory_.NewCallback(
- &QuotaFileIOTest::DidWrite)));
+ EXPECT_FALSE(quota_file_io_->Write(
+ 0, "data", 0,
+ base::Bind(&QuotaFileIOTest::DidWrite,
+ weak_ptr_factory_.GetWeakPtr())));
// Attempt to write negative number of bytes.
- EXPECT_FALSE(quota_file_io_->Write(0, "data",
- std::numeric_limits<int32_t>::min(),
- callback_factory_.NewCallback(
- &QuotaFileIOTest::DidWrite)));
+ EXPECT_FALSE(quota_file_io_->Write(
+ 0, "data",
+ std::numeric_limits<int32_t>::min(),
+ base::Bind(&QuotaFileIOTest::DidWrite,
+ weak_ptr_factory_.GetWeakPtr())));
quota_plugin_delegate()->set_available_space(100);
std::string read_buffer;
@@ -355,28 +356,28 @@ class QuotaFileIOTest : public PpapiUnittest {
void Write(int64_t offset, const std::string& data, bool will_operation) {
if (will_operation) {
ASSERT_TRUE(quota_file_io_->WillWrite(
- offset, data.size(),
- callback_factory_.NewCallback(
- &QuotaFileIOTest::DidWrite)));
+ offset, data.size(),
+ base::Bind(&QuotaFileIOTest::DidWrite,
+ weak_ptr_factory_.GetWeakPtr())));
} else {
ASSERT_TRUE(quota_file_io_->Write(
- offset, data.c_str(), data.size(),
- callback_factory_.NewCallback(
- &QuotaFileIOTest::DidWrite)));
+ offset, data.c_str(), data.size(),
+ base::Bind(&QuotaFileIOTest::DidWrite,
+ weak_ptr_factory_.GetWeakPtr())));
}
}
void SetLength(int64_t length, bool will_operation) {
if (will_operation) {
ASSERT_TRUE(quota_file_io_->WillSetLength(
- length,
- callback_factory_.NewCallback(
- &QuotaFileIOTest::DidSetLength)));
+ length,
+ base::Bind(&QuotaFileIOTest::DidSetLength,
+ weak_ptr_factory_.GetWeakPtr())));
} else {
ASSERT_TRUE(quota_file_io_->SetLength(
- length,
- callback_factory_.NewCallback(
- &QuotaFileIOTest::DidSetLength)));
+ length,
+ base::Bind(&QuotaFileIOTest::DidSetLength,
+ weak_ptr_factory_.GetWeakPtr())));
}
}
@@ -433,7 +434,7 @@ class QuotaFileIOTest : public PpapiUnittest {
scoped_ptr<QuotaFileIO> quota_file_io_;
std::deque<int> bytes_written_;
std::deque<PlatformFileError> status_;
- base::ScopedCallbackFactory<QuotaFileIOTest> callback_factory_;
+ base::WeakPtrFactory<QuotaFileIOTest> weak_ptr_factory_;
};
TEST_F(QuotaFileIOTest, Write) {
« base/file_util_proxy.h ('K') | « webkit/plugins/ppapi/quota_file_io.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698