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

Unified Diff: sync/internal_api/attachments/attachment_service_proxy_unittest.cc

Issue 548533003: Replace AttachmentStore's StoreAttachments with UploadAttachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call get() on scoped_refptr. Created 6 years, 3 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: sync/internal_api/attachments/attachment_service_proxy_unittest.cc
diff --git a/sync/internal_api/attachments/attachment_service_proxy_unittest.cc b/sync/internal_api/attachments/attachment_service_proxy_unittest.cc
index 545998dd39339fb721d436aff528f4226c7a5868..a946382af65b9060dbf67187483892840f56b50f 100644
--- a/sync/internal_api/attachments/attachment_service_proxy_unittest.cc
+++ b/sync/internal_api/attachments/attachment_service_proxy_unittest.cc
@@ -34,6 +34,8 @@ class StubAttachmentService : public AttachmentService,
virtual ~StubAttachmentService() {}
+ virtual AttachmentStore* GetStore() OVERRIDE { return NULL; }
+
virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
const GetOrDownloadCallback& callback)
OVERRIDE {
@@ -55,12 +57,10 @@ class StubAttachmentService : public AttachmentService,
FROM_HERE, base::Bind(callback, AttachmentService::DROP_SUCCESS));
}
- virtual void StoreAttachments(const AttachmentList& attachments,
- const StoreCallback& callback) OVERRIDE {
+ virtual void UploadAttachments(
+ const AttachmentIdSet& attachments_ids) OVERRIDE {
CalledOnValidThread();
Increment();
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(callback, AttachmentService::STORE_SUCCESS));
}
virtual base::WeakPtr<AttachmentService> AsWeakPtr() {
@@ -105,11 +105,8 @@ class AttachmentServiceProxyTest : public testing::Test,
base::Unretained(this));
callback_drop = base::Bind(&AttachmentServiceProxyTest::IncrementDrop,
base::Unretained(this));
- callback_store = base::Bind(&AttachmentServiceProxyTest::IncrementStore,
- base::Unretained(this));
count_callback_get_or_download = 0;
count_callback_drop = 0;
- count_callback_store = 0;
}
virtual void TearDown()
@@ -136,12 +133,6 @@ class AttachmentServiceProxyTest : public testing::Test,
++count_callback_drop;
}
- // a StoreCallback
- void IncrementStore(const AttachmentService::StoreResult&) {
- CalledOnValidThread();
- ++count_callback_store;
- }
-
void WaitForStubThread() {
base::WaitableEvent done(false, false);
stub_thread->message_loop()->PostTask(
@@ -157,23 +148,24 @@ class AttachmentServiceProxyTest : public testing::Test,
AttachmentService::GetOrDownloadCallback callback_get_or_download;
AttachmentService::DropCallback callback_drop;
- AttachmentService::StoreCallback callback_store;
// number of times callback_get_or_download was invoked
int count_callback_get_or_download;
// number of times callback_drop was invoked
int count_callback_drop;
- // number of times callback_store was invoked
- int count_callback_store;
};
-// Verify that each of AttachmentServiceProxy's callback methods (those that
-// take callbacks) are invoked on the stub and that the passed callbacks are
-// invoked in this thread.
-TEST_F(AttachmentServiceProxyTest, MethodsWithCallbacksAreProxied) {
+TEST_F(AttachmentServiceProxyTest, GetStore) {
+ EXPECT_EQ(NULL, proxy->GetStore());
+}
+
+// Verify that each of AttachmentServiceProxy's methods are invoked on the stub.
+// Verify that the methods that take callbacks invoke passed callbacks on this
+// thread.
+TEST_F(AttachmentServiceProxyTest, MethodsAreProxied) {
proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download);
proxy->DropAttachments(AttachmentIdList(), callback_drop);
- proxy->StoreAttachments(AttachmentList(), callback_store);
+ proxy->UploadAttachments(AttachmentIdSet());
// Wait for the posted calls to execute in the stub thread.
WaitForStubThread();
EXPECT_EQ(3, stub->GetCallCount());
@@ -185,7 +177,6 @@ TEST_F(AttachmentServiceProxyTest, MethodsWithCallbacksAreProxied) {
loop.RunUntilIdle();
EXPECT_EQ(1, count_callback_get_or_download);
EXPECT_EQ(1, count_callback_drop);
- EXPECT_EQ(1, count_callback_store);
}
// Verify that it's safe to use an AttachmentServiceProxy even after its wrapped
« no previous file with comments | « sync/internal_api/attachments/attachment_service_proxy.cc ('k') | sync/internal_api/public/attachments/attachment_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698