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

Side by Side Diff: chrome/browser/nacl_host/nacl_validation_cache_unittest.cc

Issue 12212048: Linux/ChromeOS Chromium style checker cleanup, chrome/browser edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 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 | 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 "base/pickle.h" 5 #include "base/pickle.h"
6 #include "chrome/browser/nacl_host/nacl_validation_cache.h" 6 #include "chrome/browser/nacl_host/nacl_validation_cache.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
11 const char key1[65] = 11 const char key1[65] =
12 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"; 12 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";
13 const char key2[65] = 13 const char key2[65] =
14 "a 64-byte string of various junk................................"; 14 "a 64-byte string of various junk................................";
15 const char sig1[33] = "0123456789ABCDEF0123456789ABCDEF"; 15 const char sig1[33] = "0123456789ABCDEF0123456789ABCDEF";
16 const char sig2[33] = "a 32-byte string of various junk"; 16 const char sig2[33] = "a 32-byte string of various junk";
17 17
18 class NaClValidationCacheTest : public ::testing::Test { 18 class NaClValidationCacheTest : public ::testing::Test {
19 protected: 19 protected:
20 NaClValidationCache cache1; 20 NaClValidationCache cache1;
21 NaClValidationCache cache2; 21 NaClValidationCache cache2;
22 22
23 void SetUp() { 23 virtual void SetUp() {
24 // The compiler chokes if std::string(key1) is passed directly as an arg. 24 // The compiler chokes if std::string(key1) is passed directly as an arg.
25 std::string key(key1); 25 std::string key(key1);
26 cache1.SetValidationCacheKey(key); 26 cache1.SetValidationCacheKey(key);
27 cache2.SetValidationCacheKey(key); 27 cache2.SetValidationCacheKey(key);
28 } 28 }
29 29
30 bool IsIdentical(const NaClValidationCache& a, 30 bool IsIdentical(const NaClValidationCache& a,
31 const NaClValidationCache& b) const { 31 const NaClValidationCache& b) const {
32 if (a.GetValidationCacheKey() != b.GetValidationCacheKey()) 32 if (a.GetValidationCacheKey() != b.GetValidationCacheKey())
33 return false; 33 return false;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 TEST_F(NaClValidationCacheTest, DeserializeJunk) { 186 TEST_F(NaClValidationCacheTest, DeserializeJunk) {
187 cache1.SetKnownToValidate(sig1); 187 cache1.SetKnownToValidate(sig1);
188 Pickle pickle(key1, strlen(key1)); 188 Pickle pickle(key1, strlen(key1));
189 ASSERT_FALSE(cache1.Deserialize(&pickle)); 189 ASSERT_FALSE(cache1.Deserialize(&pickle));
190 ASSERT_EQ(0, (int) cache1.size()); 190 ASSERT_EQ(0, (int) cache1.size());
191 } 191 }
192 192
193 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698