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 // | 117 TEST_F(KeygenHandlerTest, ConcurrencyTest) { |
118 // Disabled because it crashes on Chrome OS. See http://crbug.com/47587 | |
119 TEST_F(KeygenHandlerTest, DISABLED_ConcurrencyTest) { | |
120 const int NUM_HANDLERS = 5; | 118 const int NUM_HANDLERS = 5; |
121 base::WaitableEvent* events[NUM_HANDLERS] = { NULL }; | 119 base::WaitableEvent* events[NUM_HANDLERS] = { NULL }; |
122 std::string results[NUM_HANDLERS]; | 120 std::string results[NUM_HANDLERS]; |
123 for (int i = 0; i < NUM_HANDLERS; i++) { | 121 for (int i = 0; i < NUM_HANDLERS; i++) { |
124 events[i] = new base::WaitableEvent(false, false); | 122 events[i] = new base::WaitableEvent(false, false); |
125 WorkerPool::PostTask(FROM_HERE, | 123 WorkerPool::PostTask(FROM_HERE, |
126 new ConcurrencyTestTask(events[i], "some challenge", | 124 new ConcurrencyTestTask(events[i], "some challenge", |
127 &results[i]), | 125 &results[i]), |
128 true); | 126 true); |
129 } | 127 } |
130 | 128 |
131 for (int i = 0; i < NUM_HANDLERS; i++) { | 129 for (int i = 0; i < NUM_HANDLERS; i++) { |
132 // Make sure the job completed | 130 // Make sure the job completed |
133 bool signaled = events[i]->Wait(); | 131 bool signaled = events[i]->Wait(); |
134 EXPECT_TRUE(signaled); | 132 EXPECT_TRUE(signaled); |
135 delete events[i]; | 133 delete events[i]; |
136 events[i] = NULL; | 134 events[i] = NULL; |
137 | 135 |
138 LOG(INFO) << "KeygenHandler " << i << " produced: " << results[i]; | 136 LOG(INFO) << "KeygenHandler " << i << " produced: " << results[i]; |
139 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); | 137 AssertValidSignedPublicKeyAndChallenge(results[i], "some challenge"); |
140 } | 138 } |
141 } | 139 } |
142 | 140 |
143 } // namespace | 141 } // namespace |
144 | 142 |
145 } // namespace net | 143 } // namespace net |
OLD | NEW |