OLD | NEW |
(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/command_line.h" |
| 6 #include "content/browser/renderer_host/media/dtls_identity_service_host.h" |
| 7 #include "content/browser/web_contents/web_contents_impl.h" |
| 8 #include "content/common/media/dtls_identity_messages.h" |
| 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/test/browser_test_utils.h" |
| 11 #include "content/shell/shell.h" |
| 12 #include "content/test/content_browser_test.h" |
| 13 #include "content/test/content_browser_test_utils.h" |
| 14 |
| 15 namespace content { |
| 16 namespace { |
| 17 |
| 18 class DTLSIdentityServiceHostForTest : public DTLSIdentityServiceHost { |
| 19 protected: |
| 20 virtual ~DTLSIdentityServiceHostForTest() {} |
| 21 |
| 22 private: |
| 23 virtual void OnComplete(const std::string& certificate, |
| 24 const std::string& private_key) OVERRIDE { |
| 25 ASSERT_NE("", certificate); |
| 26 ASSERT_NE("", private_key); |
| 27 } |
| 28 }; |
| 29 |
| 30 class DTLSIdentityStoreBrowserTest : public ContentBrowserTest { |
| 31 public: |
| 32 DTLSIdentityStoreBrowserTest() {} |
| 33 virtual ~DTLSIdentityStoreBrowserTest() {} |
| 34 |
| 35 void CheckGetOrGenerateIdentity() { |
| 36 GURL url("http://google.com"); |
| 37 DTLSIdentityMsg_GetOrGenerate msg(url, "b", "c"); |
| 38 scoped_refptr<DTLSIdentityServiceHostForTest> host = |
| 39 new DTLSIdentityServiceHostForTest(); |
| 40 bool ok = true; |
| 41 host->OnMessageReceived(msg, &ok); |
| 42 ASSERT_EQ(true, ok); |
| 43 } |
| 44 }; |
| 45 |
| 46 IN_PROC_BROWSER_TEST_F(DTLSIdentityStoreBrowserTest, GetOrGenerate) { |
| 47 content::BrowserThread::PostTask( |
| 48 content::BrowserThread::IO, |
| 49 FROM_HERE, |
| 50 base::Bind(&DTLSIdentityStoreBrowserTest::CheckGetOrGenerateIdentity, |
| 51 base::Unretained(this))); |
| 52 NavigateToURL(shell(), GURL("about:blank")); |
| 53 } |
| 54 |
| 55 } // namespace |
| 56 } // namespace content |
OLD | NEW |