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

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <stack> 5 #include <stack>
6 #include <vector> 6 #include <vector>
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 const vector<sync_api::SyncManager::ChangeRecord>& changes() { 265 const vector<sync_api::SyncManager::ChangeRecord>& changes() {
266 return changes_; 266 return changes_;
267 } 267 }
268 268
269 private: 269 private:
270 // Helper function to push an ACTION_UPDATE record onto the back 270 // Helper function to push an ACTION_UPDATE record onto the back
271 // of the changelist. 271 // of the changelist.
272 void SetModified(int64 id) { 272 void SetModified(int64 id) {
273 // Coalesce multi-property edits. 273 // Coalesce multi-property edits.
274 if (changes_.size() > 0 && changes_.back().id == id && 274 if (!changes_.empty() && changes_.back().id == id &&
275 changes_.back().action == 275 changes_.back().action ==
276 sync_api::SyncManager::ChangeRecord::ACTION_UPDATE) 276 sync_api::SyncManager::ChangeRecord::ACTION_UPDATE)
277 return; 277 return;
278 sync_api::SyncManager::ChangeRecord record; 278 sync_api::SyncManager::ChangeRecord record;
279 record.action = sync_api::SyncManager::ChangeRecord::ACTION_UPDATE; 279 record.action = sync_api::SyncManager::ChangeRecord::ACTION_UPDATE;
280 record.id = id; 280 record.id = id;
281 changes_.push_back(record); 281 changes_.push_back(record);
282 } 282 }
283 283
284 // The transaction on which everything happens. 284 // The transaction on which everything happens.
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 // This file should have been deleted when the whole directory was nuked. 1659 // This file should have been deleted when the whole directory was nuked.
1660 ASSERT_FALSE(file_util::PathExists(sync_file3)); 1660 ASSERT_FALSE(file_util::PathExists(sync_file3));
1661 ASSERT_FALSE(file_util::PathExists(sync_file1)); 1661 ASSERT_FALSE(file_util::PathExists(sync_file1));
1662 1662
1663 // This will still exist, but the text should have changed. 1663 // This will still exist, but the text should have changed.
1664 ASSERT_TRUE(file_util::PathExists(sync_file2)); 1664 ASSERT_TRUE(file_util::PathExists(sync_file2));
1665 std::string file2text; 1665 std::string file2text;
1666 file_util::ReadFileToString(sync_file2, &file2text); 1666 file_util::ReadFileToString(sync_file2, &file2text);
1667 ASSERT_FALSE(file2text.compare(nonsense2) == 0); 1667 ASSERT_FALSE(file2text.compare(nonsense2) == 0);
1668 } 1668 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698