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

Side by Side Diff: sync/api/attachments/attachment_id_unittest.cc

Issue 982883002: [Sync] Add size and crc32c to AttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix argument evaluation order bug. Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sync/api/attachments/attachment.h" 5 #include "sync/api/attachments/attachment.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace syncer { 11 namespace syncer {
12 12
13 namespace {
14
15 } // namespace
16
17 class AttachmentIdTest : public testing::Test {}; 13 class AttachmentIdTest : public testing::Test {};
18 14
19 TEST_F(AttachmentIdTest, Create_IsUnique) { 15 TEST_F(AttachmentIdTest, Create_IsUnique) {
20 AttachmentId id1 = AttachmentId::Create(); 16 AttachmentId id1 = AttachmentId::Create(0, 0);
21 AttachmentId id2 = AttachmentId::Create(); 17 AttachmentId id2 = AttachmentId::Create(0, 0);
22 EXPECT_NE(id1, id2); 18 EXPECT_NE(id1, id2);
23 } 19 }
24 20
25 TEST_F(AttachmentIdTest, OperatorEqual) { 21 TEST_F(AttachmentIdTest, OperatorEqual) {
26 AttachmentId id1 = AttachmentId::Create(); 22 AttachmentId id1 = AttachmentId::Create(0, 0);
27 AttachmentId id2(id1); 23 AttachmentId id2(id1);
28 EXPECT_EQ(id1, id2); 24 EXPECT_EQ(id1, id2);
29 } 25 }
30 26
31 TEST_F(AttachmentIdTest, OperatorLess) { 27 TEST_F(AttachmentIdTest, OperatorLess) {
32 AttachmentId id1 = AttachmentId::Create(); 28 AttachmentId id1 = AttachmentId::Create(0, 0);
33 EXPECT_FALSE(id1 < id1); 29 EXPECT_FALSE(id1 < id1);
34 30
35 AttachmentId id2 = AttachmentId::Create(); 31 AttachmentId id2 = AttachmentId::Create(0, 0);
36 EXPECT_FALSE(id1 < id1); 32 EXPECT_FALSE(id1 < id1);
37 33
38 EXPECT_NE(id1, id2); 34 EXPECT_NE(id1, id2);
39 if (id1 < id2) { 35 if (id1 < id2) {
40 EXPECT_FALSE(id2 < id1); 36 EXPECT_FALSE(id2 < id1);
41 } else { 37 } else {
42 EXPECT_TRUE(id2 < id1); 38 EXPECT_TRUE(id2 < id1);
43 } 39 }
44 } 40 }
45 41
46 } // namespace syncer 42 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698