| OLD | NEW |
| 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 "net/base/keygen_handler.h" | 5 #include "net/base/keygen_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace net { | 24 namespace net { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class KeygenHandlerTest : public ::testing::Test { | 28 class KeygenHandlerTest : public ::testing::Test { |
| 29 public: | 29 public: |
| 30 KeygenHandlerTest() {} | 30 KeygenHandlerTest() {} |
| 31 virtual ~KeygenHandlerTest() {} | 31 virtual ~KeygenHandlerTest() {} |
| 32 | 32 |
| 33 virtual void SetUp() { | 33 virtual void SetUp() { |
| 34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) && defined(USE_NSS) |
| 35 crypto::OpenPersistentNSSDB(); | 35 crypto::OpenPersistentNSSDB(); |
| 36 #endif | 36 #endif |
| 37 } | 37 } |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // Assert that |result| is a valid output for KeygenHandler given challenge | 40 // Assert that |result| is a valid output for KeygenHandler given challenge |
| 41 // string of |challenge|. | 41 // string of |challenge|. |
| 42 void AssertValidSignedPublicKeyAndChallenge(const std::string& result, | 42 void AssertValidSignedPublicKeyAndChallenge(const std::string& result, |
| 43 const std::string& challenge) { | 43 const std::string& challenge) { |
| 44 ASSERT_GT(result.length(), 0U); | 44 ASSERT_GT(result.length(), 0U); |
| 45 | 45 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 events[i] = NULL; | 125 events[i] = NULL; |
| 126 | 126 |
| 127 VLOG(1) << "KeygenHandler " << i << " produced: " << results[i]; | 127 VLOG(1) << "KeygenHandler " << i << " produced: " << results[i]; |
| 128 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); | 128 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 } // namespace net | 134 } // namespace net |
| OLD | NEW |