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

Side by Side Diff: chrome/browser/sync_file_system/fake_drive_file_sync_client_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync_file_system/fake_drive_file_sync_client.h" 5 #include "chrome/browser/sync_file_system/fake_drive_file_sync_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 void DidDeleteFile(google_apis::GDataErrorCode* error_out, 37 void DidDeleteFile(google_apis::GDataErrorCode* error_out,
38 google_apis::GDataErrorCode error) { 38 google_apis::GDataErrorCode error) {
39 *error_out = error; 39 *error_out = error;
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 43
44 TEST(FakeDriveFileSyncClientTest, ChangeSquashTest) { 44 TEST(FakeDriveFileSyncClientTest, ChangeSquashTest) {
45 MessageLoop message_loop; 45 base::MessageLoop message_loop;
46 FakeDriveFileSyncClient sync_client; 46 FakeDriveFileSyncClient sync_client;
47 std::string kParentResourceId("parent resource id"); 47 std::string kParentResourceId("parent resource id");
48 std::string kParentTitle("app-id"); 48 std::string kParentTitle("app-id");
49 std::string kTitle1("title 1"); 49 std::string kTitle1("title 1");
50 std::string kTitle2("title 2"); 50 std::string kTitle2("title 2");
51 std::string kTitle3("title 3"); 51 std::string kTitle3("title 3");
52 std::string kResourceId1("resource id 1"); 52 std::string kResourceId1("resource id 1");
53 std::string kResourceId2("resource id 2"); 53 std::string kResourceId2("resource id 2");
54 std::string kMD5_1("md5 1"); 54 std::string kMD5_1("md5 1");
55 std::string kMD5_2("md5 2"); 55 std::string kMD5_2("md5 2");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 EXPECT_EQ(kResourceId1, change_list->entries()[0]->resource_id()); 92 EXPECT_EQ(kResourceId1, change_list->entries()[0]->resource_id());
93 EXPECT_TRUE(change_list->entries()[0]->deleted()); 93 EXPECT_TRUE(change_list->entries()[0]->deleted());
94 94
95 EXPECT_EQ(kResourceId2, change_list->entries()[1]->resource_id()); 95 EXPECT_EQ(kResourceId2, change_list->entries()[1]->resource_id());
96 EXPECT_EQ(kMD5_3, change_list->entries()[1]->file_md5()); 96 EXPECT_EQ(kMD5_3, change_list->entries()[1]->file_md5());
97 EXPECT_FALSE(change_list->entries()[1]->deleted()); 97 EXPECT_FALSE(change_list->entries()[1]->deleted());
98 } 98 }
99 99
100 TEST(FakeDriveFileSyncClientTest, DeleteFile) { 100 TEST(FakeDriveFileSyncClientTest, DeleteFile) {
101 MessageLoop message_loop; 101 base::MessageLoop message_loop;
102 FakeDriveFileSyncClient sync_client; 102 FakeDriveFileSyncClient sync_client;
103 std::string resource_id = "resource_id_to_be_deleted"; 103 std::string resource_id = "resource_id_to_be_deleted";
104 sync_client.PushRemoteChange( 104 sync_client.PushRemoteChange(
105 "parent_id", "parent_title", 105 "parent_id", "parent_title",
106 "resource_title", resource_id, "resource_md5", false /* deleted */); 106 "resource_title", resource_id, "resource_md5", false /* deleted */);
107 107
108 google_apis::GDataErrorCode error = google_apis::HTTP_NOT_FOUND; 108 google_apis::GDataErrorCode error = google_apis::HTTP_NOT_FOUND;
109 sync_client.DeleteFile( 109 sync_client.DeleteFile(
110 resource_id, 110 resource_id,
111 std::string(), 111 std::string(),
112 base::Bind(&DidDeleteFile, &error)); 112 base::Bind(&DidDeleteFile, &error));
113 message_loop.RunUntilIdle(); 113 message_loop.RunUntilIdle();
114 114
115 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 115 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
116 EXPECT_TRUE(sync_client.remote_resources().find(resource_id)->second.deleted); 116 EXPECT_TRUE(sync_client.remote_resources().find(resource_id)->second.deleted);
117 } 117 }
118 118
119 } // namespace sync_file_system 119 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698