| Index: chrome/browser/net/keygen_handler_browsertest.cc
|
| diff --git a/chrome/browser/net/keygen_handler_browsertest.cc b/chrome/browser/net/keygen_handler_browsertest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bd11d571d466b49909d032d545f16c26f8cbd728
|
| --- /dev/null
|
| +++ b/chrome/browser/net/keygen_handler_browsertest.cc
|
| @@ -0,0 +1,58 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/net/keygen_handler.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/base64.h"
|
| +#include "base/bind.h"
|
| +#include "base/run_loop.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/profiles/profile_io_data.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/test/base/in_process_browser_test.h"
|
| +#include "net/base/keygen_handler_test_util.h"
|
| +
|
| +namespace {
|
| +
|
| +void KeygenComplete(std::string* output_result,
|
| + base::RunLoop* run_loop,
|
| + const std::string* input_result) {
|
| + if (input_result)
|
| + *output_result = *input_result;
|
| + run_loop->Quit();
|
| +}
|
| +
|
| +class ChromeKeygenHandlerTest : public InProcessBrowserTest {
|
| + public:
|
| + ChromeKeygenHandlerTest() {}
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(ChromeKeygenHandlerTest);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +IN_PROC_BROWSER_TEST_F(ChromeKeygenHandlerTest, ConcurrencyTest) {
|
| + const int NUM_HANDLERS = 5;
|
| + std::string results[NUM_HANDLERS];
|
| + base::RunLoop run_loop[NUM_HANDLERS];
|
| + for (int i = 0; i < NUM_HANDLERS; i++) {
|
| + chrome_browser_net::Keygen(
|
| + browser()->profile()->GetResourceContext(),
|
| + 768,
|
| + "some challenge",
|
| + GURL("http://www.example.com"),
|
| + false,
|
| + base::Bind(&KeygenComplete, &results[i], &run_loop[i]));
|
| + }
|
| +
|
| + for (int i = 0; i < NUM_HANDLERS; i++) {
|
| + run_loop[i].Run();
|
| + VLOG(1) << "KeygenHandler " << i << " produced: " << results[i];
|
| + net::AssertValidSignedPublicKeyAndChallenge(
|
| + results[i], 768, "some challenge");
|
| + }
|
| +}
|
|
|