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

Side by Side Diff: crypto/p224_spake_unittest.cc

Issue 11368035: crypto: Remove forbidden using namespace directive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « no previous file | crypto/p224_unittest.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <crypto/p224_spake.h> 5 #include <crypto/p224_spake.h>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using namespace crypto; 10 namespace crypto {
11
12 namespace {
11 13
12 bool RunExchange(P224EncryptedKeyExchange* client, 14 bool RunExchange(P224EncryptedKeyExchange* client,
13 P224EncryptedKeyExchange* server) { 15 P224EncryptedKeyExchange* server) {
14 16
15 for (;;) { 17 for (;;) {
16 std::string client_message, server_message; 18 std::string client_message, server_message;
17 client_message = client->GetMessage(); 19 client_message = client->GetMessage();
18 server_message = server->GetMessage(); 20 server_message = server->GetMessage();
19 21
20 P224EncryptedKeyExchange::Result client_result, server_result; 22 P224EncryptedKeyExchange::Result client_result, server_result;
(...skipping 14 matching lines...) Expand all
35 if (client_result == P224EncryptedKeyExchange::kResultSuccess && 37 if (client_result == P224EncryptedKeyExchange::kResultSuccess &&
36 server_result == P224EncryptedKeyExchange::kResultSuccess) { 38 server_result == P224EncryptedKeyExchange::kResultSuccess) {
37 return true; 39 return true;
38 } 40 }
39 41
40 CHECK_EQ(P224EncryptedKeyExchange::kResultPending, client_result); 42 CHECK_EQ(P224EncryptedKeyExchange::kResultPending, client_result);
41 CHECK_EQ(P224EncryptedKeyExchange::kResultPending, server_result); 43 CHECK_EQ(P224EncryptedKeyExchange::kResultPending, server_result);
42 } 44 }
43 } 45 }
44 46
45 static const char kPassword[] = "foo"; 47 const char kPassword[] = "foo";
48
49 } // namespace
46 50
47 TEST(MutualAuth, CorrectAuth) { 51 TEST(MutualAuth, CorrectAuth) {
48 P224EncryptedKeyExchange client( 52 P224EncryptedKeyExchange client(
49 P224EncryptedKeyExchange::kPeerTypeClient, kPassword); 53 P224EncryptedKeyExchange::kPeerTypeClient, kPassword);
50 P224EncryptedKeyExchange server( 54 P224EncryptedKeyExchange server(
51 P224EncryptedKeyExchange::kPeerTypeServer, kPassword); 55 P224EncryptedKeyExchange::kPeerTypeServer, kPassword);
52 56
53 EXPECT_TRUE(RunExchange(&client, &server)); 57 EXPECT_TRUE(RunExchange(&client, &server));
54 EXPECT_EQ(client.GetKey(), server.GetKey()); 58 EXPECT_EQ(client.GetKey(), server.GetKey());
55 } 59 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 break; 119 break;
116 } 120 }
117 121
118 ASSERT_EQ(P224EncryptedKeyExchange::kResultPending, 122 ASSERT_EQ(P224EncryptedKeyExchange::kResultPending,
119 client_result); 123 client_result);
120 ASSERT_EQ(P224EncryptedKeyExchange::kResultPending, 124 ASSERT_EQ(P224EncryptedKeyExchange::kResultPending,
121 server_result); 125 server_result);
122 } 126 }
123 } 127 }
124 } 128 }
129
130 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | crypto/p224_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698