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

Side by Side Diff: content/browser/media/dtls_identity_store_unittest.cc

Issue 15969025: Generates the DTLS identity in browser process and returns it to render process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h"
7 #include "base/threading/sequenced_worker_pool.h"
8 #include "content/browser/media/dtls_identity_store.h"
9 #include "content/public/test/test_browser_thread.h"
10 #include "googleurl/src/gurl.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13
14 namespace content {
15 namespace {
16
17 class DTLSIdentityStoreTest : public testing::Test {
18 public:
19 DTLSIdentityStoreTest() :
20 ui_thread_(BrowserThread::UI, &message_loop_),
21 sequenced_worker_pool_(new base::SequencedWorkerPool(
22 3, "ServerBoundCertServiceTest")),
23 completed_(false) {}
24
25 virtual ~DTLSIdentityStoreTest() {
26 sequenced_worker_pool_->Shutdown();
27 }
28
29 void OnGetOrGenerateCompleted(const std::string& certificate,
30 const std::string& private_key) {
31 ASSERT_NE("", certificate);
32 ASSERT_NE("", private_key);
33 completed_ = true;
34 }
35
36 protected:
37 virtual void SetUp() {
38 completed_ = false;
39 }
Ryan Sleevi 2013/06/04 19:13:52 There is no need to use SetUp/TearDown see https:
jiayl 2013/06/06 05:10:24 Done.
40
41 base::MessageLoopForUI message_loop_;
42 TestBrowserThread ui_thread_;
43 scoped_refptr<base::SequencedWorkerPool> sequenced_worker_pool_;
44 bool completed_;
45 };
46
47 TEST_F(DTLSIdentityStoreTest, GetOrGenerateIdentity) {
48 DTLSIdentityStore* store = new DTLSIdentityStore(sequenced_worker_pool_);
49 store->GetOrGenerateIdentity(
50 GURL("http://google.com"), "a", "b",
51 base::Bind(&DTLSIdentityStoreTest::OnGetOrGenerateCompleted,
52 base::Unretained(this)));
53 sequenced_worker_pool_->FlushForTesting();
54 message_loop_.RunUntilIdle();
55
56 EXPECT_EQ(true, completed_);
57 }
58
59 } // namespace
60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698