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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc

Issue 10836354: Rename GData* to Drive* in gdata.proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for comments. Created 8 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/gdata/gdata_sync_client.h" 5 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/scoped_temp_dir.h" 16 #include "base/scoped_temp_dir.h"
17 #include "base/test/test_timeouts.h" 17 #include "base/test/test_timeouts.h"
18 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
19 #include "chrome/browser/chromeos/cros/cros_library.h" 19 #include "chrome/browser/chromeos/cros/cros_library.h"
20 #include "chrome/browser/chromeos/cros/mock_network_library.h" 20 #include "chrome/browser/chromeos/cros/mock_network_library.h"
21 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 21 #include "chrome/browser/chromeos/gdata/drive.pb.h"
22 #include "chrome/browser/chromeos/gdata/gdata_test_util.h" 22 #include "chrome/browser/chromeos/gdata/gdata_test_util.h"
23 #include "chrome/browser/chromeos/gdata/gdata_util.h" 23 #include "chrome/browser/chromeos/gdata/gdata_util.h"
24 #include "chrome/browser/chromeos/gdata/mock_gdata_file_system.h" 24 #include "chrome/browser/chromeos/gdata/mock_gdata_file_system.h"
25 #include "chrome/browser/prefs/pref_service.h" 25 #include "chrome/browser/prefs/pref_service.h"
26 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
28 #include "chrome/test/base/testing_profile.h" 28 #include "chrome/test/base/testing_profile.h"
29 #include "content/public/test/test_browser_thread.h" 29 #include "content/public/test/test_browser_thread.h"
30 #include "testing/gmock/include/gmock/gmock.h" 30 #include "testing/gmock/include/gmock/gmock.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 11 matching lines...) Expand all
43 arg1.Run(error, local_path, mime_type, file_type); 43 arg1.Run(error, local_path, mime_type, file_type);
44 } 44 }
45 45
46 // Action used to set mock expectations for UpdateFileByResourceId(). 46 // Action used to set mock expectations for UpdateFileByResourceId().
47 ACTION_P(MockUpdateFileByResourceId, error) { 47 ACTION_P(MockUpdateFileByResourceId, error) {
48 arg1.Run(error); 48 arg1.Run(error);
49 } 49 }
50 50
51 // Action used to set mock expectations for GetFileInfoByResourceId(). 51 // Action used to set mock expectations for GetFileInfoByResourceId().
52 ACTION_P2(MockUpdateFileByResourceId, error, md5) { 52 ACTION_P2(MockUpdateFileByResourceId, error, md5) {
53 scoped_ptr<GDataEntryProto> entry_proto(new GDataEntryProto); 53 scoped_ptr<DriveEntryProto> entry_proto(new DriveEntryProto);
54 entry_proto->mutable_file_specific_info()->set_file_md5(md5); 54 entry_proto->mutable_file_specific_info()->set_file_md5(md5);
55 arg1.Run(error, FilePath(), entry_proto.Pass()); 55 arg1.Run(error, FilePath(), entry_proto.Pass());
56 } 56 }
57 57
58 class GDataSyncClientTest : public testing::Test { 58 class GDataSyncClientTest : public testing::Test {
59 public: 59 public:
60 GDataSyncClientTest() 60 GDataSyncClientTest()
61 : ui_thread_(content::BrowserThread::UI, &message_loop_), 61 : ui_thread_(content::BrowserThread::UI, &message_loop_),
62 io_thread_(content::BrowserThread::IO), 62 io_thread_(content::BrowserThread::IO),
63 profile_(new TestingProfile), 63 profile_(new TestingProfile),
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 EXPECT_CALL(*mock_file_system_, 236 EXPECT_CALL(*mock_file_system_,
237 UpdateFileByResourceId(resource_id, _)) 237 UpdateFileByResourceId(resource_id, _))
238 .WillOnce(MockUpdateFileByResourceId(GDATA_FILE_OK)); 238 .WillOnce(MockUpdateFileByResourceId(GDATA_FILE_OK));
239 } 239 }
240 240
241 // Sets the expectation for MockGDataFileSystem::GetFileInfoByResourceId(), 241 // Sets the expectation for MockGDataFileSystem::GetFileInfoByResourceId(),
242 // that simulates successful retrieval of file info for the given resource 242 // that simulates successful retrieval of file info for the given resource
243 // ID. 243 // ID.
244 // 244 //
245 // This is used for testing StartCheckingExistingPinnedFiles(), hence we 245 // This is used for testing StartCheckingExistingPinnedFiles(), hence we
246 // are only interested in the MD5 value in GDataEntryProto. 246 // are only interested in the MD5 value in DriveEntryProto.
247 void SetExpectationForGetFileInfoByResourceId( 247 void SetExpectationForGetFileInfoByResourceId(
248 const std::string& resource_id, 248 const std::string& resource_id,
249 const std::string& new_md5) { 249 const std::string& new_md5) {
250 EXPECT_CALL(*mock_file_system_, 250 EXPECT_CALL(*mock_file_system_,
251 GetEntryInfoByResourceId(resource_id, _)) 251 GetEntryInfoByResourceId(resource_id, _))
252 .WillOnce(MockUpdateFileByResourceId( 252 .WillOnce(MockUpdateFileByResourceId(
253 GDATA_FILE_OK, 253 GDATA_FILE_OK,
254 new_md5)); 254 new_md5));
255 } 255 }
256 256
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 ASSERT_EQ(1U, resource_ids.size()); 565 ASSERT_EQ(1U, resource_ids.size());
566 EXPECT_EQ("resource_id_fetched", resource_ids[0]); 566 EXPECT_EQ("resource_id_fetched", resource_ids[0]);
567 // resource_id_dirty is not collected in the queue. 567 // resource_id_dirty is not collected in the queue.
568 568
569 // Check the contents of the queue for uploading. 569 // Check the contents of the queue for uploading.
570 resource_ids = GetResourceIdsToBeUploaded(); 570 resource_ids = GetResourceIdsToBeUploaded();
571 ASSERT_TRUE(resource_ids.empty()); 571 ASSERT_TRUE(resource_ids.empty());
572 } 572 }
573 573
574 } // namespace gdata 574 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_sync_client.cc ('k') | chrome/browser/chromeos/gdata/gdata_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698