| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" // Needs to be imported early for USE_NSS | 7 #include "build/build_config.h" // Needs to be imported early for USE_NSS |
| 8 | 8 |
| 9 #if defined(USE_NSS) | 9 #if defined(USE_NSS) |
| 10 #include <private/pprthred.h> // PR_DetachThread | 10 #include <private/pprthred.h> // PR_DetachThread |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 base::WaitableEvent* event_; | 110 base::WaitableEvent* event_; |
| 111 std::string challenge_; | 111 std::string challenge_; |
| 112 std::string* result_; | 112 std::string* result_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // We asynchronously generate the keys so as not to hang up the IO thread. This | 115 // We asynchronously generate the keys so as not to hang up the IO thread. This |
| 116 // test tries to catch concurrency problems in the keygen implementation. | 116 // test tries to catch concurrency problems in the keygen implementation. |
| 117 TEST_F(KeygenHandlerTest, ConcurrencyTest) { | 117 // |
| 118 // Disabled because it crashes on Chrome OS. See |
| 119 // http://code.google.com/p/chromium/issues/detail?id=47587 |
| 120 TEST_F(KeygenHandlerTest, DISABLED_ConcurrencyTest) { |
| 118 const int NUM_HANDLERS = 5; | 121 const int NUM_HANDLERS = 5; |
| 119 base::WaitableEvent* events[NUM_HANDLERS] = { NULL }; | 122 base::WaitableEvent* events[NUM_HANDLERS] = { NULL }; |
| 120 std::string results[NUM_HANDLERS]; | 123 std::string results[NUM_HANDLERS]; |
| 121 for (int i = 0; i < NUM_HANDLERS; i++) { | 124 for (int i = 0; i < NUM_HANDLERS; i++) { |
| 122 events[i] = new base::WaitableEvent(false, false); | 125 events[i] = new base::WaitableEvent(false, false); |
| 123 WorkerPool::PostTask(FROM_HERE, | 126 WorkerPool::PostTask(FROM_HERE, |
| 124 new ConcurrencyTestTask(events[i], "some challenge", | 127 new ConcurrencyTestTask(events[i], "some challenge", |
| 125 &results[i]), | 128 &results[i]), |
| 126 true); | 129 true); |
| 127 } | 130 } |
| 128 | 131 |
| 129 for (int i = 0; i < NUM_HANDLERS; i++) { | 132 for (int i = 0; i < NUM_HANDLERS; i++) { |
| 130 // Make sure the job completed | 133 // Make sure the job completed |
| 131 bool signaled = events[i]->Wait(); | 134 bool signaled = events[i]->Wait(); |
| 132 EXPECT_TRUE(signaled); | 135 EXPECT_TRUE(signaled); |
| 133 delete events[i]; | 136 delete events[i]; |
| 134 events[i] = NULL; | 137 events[i] = NULL; |
| 135 | 138 |
| 136 LOG(INFO) << "KeygenHandler " << i << " produced: " << results[i]; | 139 LOG(INFO) << "KeygenHandler " << i << " produced: " << results[i]; |
| 137 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); | 140 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); |
| 138 } | 141 } |
| 139 } | 142 } |
| 140 | 143 |
| 141 } // namespace | 144 } // namespace |
| 142 | 145 |
| 143 } // namespace net | 146 } // namespace net |
| OLD | NEW |