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

Side by Side Diff: content/renderer/media/dtls_identity_service_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 "content/common/media/dtls_identity_messages.h"
6 #include "content/public/test/mock_render_thread.h"
7 #include "content/renderer/media/dtls_identity_service.h"
8 #include "googleurl/src/gurl.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/libjingle/source/talk/base/scoped_ptr.h"
11
12 namespace content {
13 namespace {
14
15 class MockDTLSIdentityObserver : public DTLSIdentityObserver {
16 public:
17 virtual void OnCompleted(const std::string& certificate,
18 const std::string& private_key) OVERRIDE {}
19 };
20
21 class DTLSIdentityServiceForTest : public DTLSIdentityService {
22 public:
23 DTLSIdentityServiceForTest(
24 const GURL& origin,
25 talk_base::scoped_ptr<DTLSIdentityObserver>& observer,
26 RenderThread* render_thread)
27 : DTLSIdentityService(origin, observer),
28 render_thread_(render_thread) {}
29
30 protected:
31 virtual RenderThread* GetRenderThread() OVERRIDE {
32 return render_thread_;
33 }
34
35 private:
36 RenderThread* render_thread_;
37 };
38
39 class DTLSIdentityServiceTest : public testing::Test {
40 };
41
42 TEST_F(DTLSIdentityServiceTest, RequestIdentity) {
43 const GURL origin("http://google.com");
44 const std::string identity_name = "a";
45 const std::string common_name = "b";
46
47 talk_base::scoped_ptr<DTLSIdentityObserver> identity_observer;
48 identity_observer.reset(new MockDTLSIdentityObserver());
49
50 MockRenderThread mock_render_thread;
51 DTLSIdentityServiceForTest service(
52 origin, identity_observer, &mock_render_thread);
53 service.Initialize();
54 service.RequestIdentity(identity_name, common_name);
55
56 const IPC::Message* msg = mock_render_thread.sink().GetFirstMessageMatching(
57 DTLSIdentityMsg_RequestIdentity::ID);
58 Tuple3<GURL, std::string, std::string> params;
59 DTLSIdentityMsg_RequestIdentity::Read(msg, &params);
60
61 EXPECT_EQ(origin, params.a);
62 EXPECT_EQ(identity_name, params.b);
63 EXPECT_EQ(common_name, params.c);
Ami GONE FROM CHROMIUM 2013/06/06 21:33:04 The only thing this test tests is that when you re
64 }
65
66 } // namespace
67 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698