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

Side by Side Diff: chromeos/dbus/fake_easy_unlock_client_unittest.cc

Issue 518643002: Add ability to pass decryption key id to CreateSecureMessage method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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 "chromeos/dbus/fake_easy_unlock_client.h" 5 #include "chromeos/dbus/fake_easy_unlock_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 TEST(FakeEasyUnlockClientTest, CreateSecureMessage) { 202 TEST(FakeEasyUnlockClientTest, CreateSecureMessage) {
203 chromeos::FakeEasyUnlockClient client; 203 chromeos::FakeEasyUnlockClient client;
204 204
205 std::string message; 205 std::string message;
206 client.CreateSecureMessage( 206 client.CreateSecureMessage(
207 "PAYLOAD", 207 "PAYLOAD",
208 "KEY", 208 "KEY",
209 "ASSOCIATED_DATA", 209 "ASSOCIATED_DATA",
210 "PUBLIC_METADATA", 210 "PUBLIC_METADATA",
211 "VERIFICATION_KEY_ID", 211 "VERIFICATION_KEY_ID",
212 "DECRYPTION_KEY_ID",
212 "ENCRYPTION_TYPE", 213 "ENCRYPTION_TYPE",
213 "SIGNATURE_TYPE", 214 "SIGNATURE_TYPE",
214 base::Bind(&RecordData, &message)); 215 base::Bind(&RecordData, &message));
215 216
216 const std::string expected_message( 217 const std::string expected_message(
217 "{\"securemessage\": {" 218 "{\"securemessage\": {"
218 "\"payload\": \"PAYLOAD\"," 219 "\"payload\": \"PAYLOAD\","
219 "\"key\": \"KEY\"," 220 "\"key\": \"KEY\","
220 "\"associated_data\": \"ASSOCIATED_DATA\"," 221 "\"associated_data\": \"ASSOCIATED_DATA\","
221 "\"public_metadata\": \"PUBLIC_METADATA\"," 222 "\"public_metadata\": \"PUBLIC_METADATA\","
222 "\"verification_key_id\": \"VERIFICATION_KEY_ID\"," 223 "\"verification_key_id\": \"VERIFICATION_KEY_ID\","
224 "\"decryption_key_id\": \"DECRYPTION_KEY_ID\","
223 "\"encryption_type\": \"ENCRYPTION_TYPE\"," 225 "\"encryption_type\": \"ENCRYPTION_TYPE\","
224 "\"signature_type\": \"SIGNATURE_TYPE\"}" 226 "\"signature_type\": \"SIGNATURE_TYPE\"}"
225 "}"); 227 "}");
226 ASSERT_EQ(expected_message, message); 228 ASSERT_EQ(expected_message, message);
227 } 229 }
228 230
229 TEST(FakeEasyUnlockClientTest, UnwrapSecureMessage) { 231 TEST(FakeEasyUnlockClientTest, UnwrapSecureMessage) {
230 chromeos::FakeEasyUnlockClient client; 232 chromeos::FakeEasyUnlockClient client;
231 233
232 std::string message; 234 std::string message;
(...skipping 11 matching lines...) Expand all
244 "\"key\": \"KEY\"," 246 "\"key\": \"KEY\","
245 "\"associated_data\": \"ASSOCIATED_DATA\"," 247 "\"associated_data\": \"ASSOCIATED_DATA\","
246 "\"encryption_type\": \"ENCRYPTION_TYPE\"," 248 "\"encryption_type\": \"ENCRYPTION_TYPE\","
247 "\"signature_type\": \"SIGNATURE_TYPE\"}" 249 "\"signature_type\": \"SIGNATURE_TYPE\"}"
248 "}"); 250 "}");
249 ASSERT_EQ(expected_message, message); 251 ASSERT_EQ(expected_message, message);
250 } 252 }
251 253
252 } // namespace 254 } // namespace
253 255
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698