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

Side by Side Diff: chrome/browser/safe_browsing/protocol_parser_unittest.cc

Issue 878333002: fix operator precedence in test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "chrome/browser/safe_browsing/protocol_parser.h" 9 #include "chrome/browser/safe_browsing/protocol_parser.h"
10 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 10 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 '0', '1', '0', '1', '0', '1', '0', '1', 71 '0', '1', '0', '1', '0', '1', '0', '1',
72 72
73 '2', '3', '2', '3', '2', '3', '2', '3', 73 '2', '3', '2', '3', '2', '3', '2', '3',
74 '2', '3', '2', '3', '2', '3', '2', '3', 74 '2', '3', '2', '3', '2', '3', '2', '3',
75 '2', '3', '2', '3', '2', '3', '2', '3', 75 '2', '3', '2', '3', '2', '3', '2', '3',
76 '2', '3', '2', '3', '2', '3', '2', '3', 76 '2', '3', '2', '3', '2', '3', '2', '3',
77 }; 77 };
78 78
79 SBFullHash full_hash1, full_hash2; 79 SBFullHash full_hash1, full_hash2;
80 for (int i = 0; i < 32; ++i) { 80 for (int i = 0; i < 32; ++i) {
81 full_hash1.full_hash[i] = i % 2 ? '1' : '0'; 81 full_hash1.full_hash[i] = (i % 2) ? '1' : '0';
82 full_hash2.full_hash[i] = i % 2 ? '3' : '2'; 82 full_hash2.full_hash[i] = (i % 2) ? '3' : '2';
83 } 83 }
84 84
85 ScopedVector<SBChunkData> chunks; 85 ScopedVector<SBChunkData> chunks;
86 EXPECT_TRUE(safe_browsing::ParseChunk(kRawAddChunk, sizeof(kRawAddChunk), 86 EXPECT_TRUE(safe_browsing::ParseChunk(kRawAddChunk, sizeof(kRawAddChunk),
87 &chunks)); 87 &chunks));
88 ASSERT_EQ(1U, chunks.size()); 88 ASSERT_EQ(1U, chunks.size());
89 EXPECT_EQ(1, chunks[0]->ChunkNumber()); 89 EXPECT_EQ(1, chunks[0]->ChunkNumber());
90 EXPECT_TRUE(chunks[0]->IsAdd()); 90 EXPECT_TRUE(chunks[0]->IsAdd());
91 EXPECT_FALSE(chunks[0]->IsSub()); 91 EXPECT_FALSE(chunks[0]->IsSub());
92 EXPECT_FALSE(chunks[0]->IsPrefix()); 92 EXPECT_FALSE(chunks[0]->IsPrefix());
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 EXPECT_FALSE(chunks[0]->IsAdd()); 709 EXPECT_FALSE(chunks[0]->IsAdd());
710 EXPECT_TRUE(chunks[0]->IsSub()); 710 EXPECT_TRUE(chunks[0]->IsSub());
711 EXPECT_TRUE(chunks[2]->IsPrefix()); 711 EXPECT_TRUE(chunks[2]->IsPrefix());
712 EXPECT_FALSE(chunks[2]->IsFullHash()); 712 EXPECT_FALSE(chunks[2]->IsFullHash());
713 ASSERT_EQ(1U, chunks[2]->PrefixCount()); 713 ASSERT_EQ(1U, chunks[2]->PrefixCount());
714 EXPECT_EQ(0x70707070U, chunks[2]->PrefixAt(0)); // pppp 714 EXPECT_EQ(0x70707070U, chunks[2]->PrefixAt(0)); // pppp
715 EXPECT_EQ(11, chunks[2]->AddChunkNumberAt(0)); 715 EXPECT_EQ(11, chunks[2]->AddChunkNumberAt(0));
716 } 716 }
717 717
718 } // namespace 718 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698