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

Side by Side Diff: extensions/browser/computed_hashes_unittest.cc

Issue 447113002: [gcc 4.8] Remove multi-line comment to avoid build break due to -Werror=comment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« 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 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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "crypto/sha2.h" 8 #include "crypto/sha2.h"
9 #include "extensions/browser/computed_hashes.h" 9 #include "extensions/browser/computed_hashes.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 EXPECT_EQ(hashes2, read_hashes2); 71 EXPECT_EQ(hashes2, read_hashes2);
72 } 72 }
73 73
74 // Note: the expected hashes used in this test were generated using linux 74 // Note: the expected hashes used in this test were generated using linux
75 // command line tools. E.g., from a bash prompt: 75 // command line tools. E.g., from a bash prompt:
76 // $ printf "hello world" | openssl dgst -sha256 -binary | base64 76 // $ printf "hello world" | openssl dgst -sha256 -binary | base64
77 // 77 //
78 // The file with multiple-blocks expectations were generated by doing: 78 // The file with multiple-blocks expectations were generated by doing:
79 // $ for i in `seq 500 ; do printf "hello world" ; done > hello.txt 79 // $ for i in `seq 500 ; do printf "hello world" ; done > hello.txt
80 // $ dd if=hello.txt bs=4096 count=1 | openssl dgst -sha256 -binary | base64 80 // $ dd if=hello.txt bs=4096 count=1 | openssl dgst -sha256 -binary | base64
81 // $ dd if=hello.txt skip=1 bs=4096 count=1 | \ 81 // $ dd if=hello.txt skip=1 bs=4096 count=1 |
82 // openssl dgst -sha256 -binary | base64 82 // openssl dgst -sha256 -binary | base64
83 TEST(ComputedHashes, ComputeHashesForContent) { 83 TEST(ComputedHashes, ComputeHashesForContent) {
84 const int block_size = 4096; 84 const int block_size = 4096;
85 85
86 // Simple short input. 86 // Simple short input.
87 std::string content1 = "hello world"; 87 std::string content1 = "hello world";
88 std::string content1_expected_hash = 88 std::string content1_expected_hash =
89 "uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek="; 89 "uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=";
90 std::vector<std::string> hashes1; 90 std::vector<std::string> hashes1;
91 ComputedHashes::ComputeHashesForContent(content1, block_size, &hashes1); 91 ComputedHashes::ComputeHashesForContent(content1, block_size, &hashes1);
(...skipping 16 matching lines...) Expand all
108 // Now an empty input. 108 // Now an empty input.
109 std::string content3; 109 std::string content3;
110 std::vector<std::string> hashes3; 110 std::vector<std::string> hashes3;
111 ComputedHashes::ComputeHashesForContent(content3, block_size, &hashes3); 111 ComputedHashes::ComputeHashesForContent(content3, block_size, &hashes3);
112 ASSERT_EQ(1u, hashes3.size()); 112 ASSERT_EQ(1u, hashes3.size());
113 ASSERT_EQ(std::string("47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="), 113 ASSERT_EQ(std::string("47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="),
114 Base64Encode(hashes3[0])); 114 Base64Encode(hashes3[0]));
115 } 115 }
116 116
117 } // namespace extensions 117 } // namespace extensions
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