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

Unified Diff: content/browser/media/dtls_identity_store_browsertest.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: fix 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/dtls_identity_store_browsertest.cc
diff --git a/content/browser/media/dtls_identity_store_browsertest.cc b/content/browser/media/dtls_identity_store_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..aa066505c20e43564098ef55ecd8cc3a49cb7117
--- /dev/null
+++ b/content/browser/media/dtls_identity_store_browsertest.cc
@@ -0,0 +1,56 @@
+// 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 "base/command_line.h"
+#include "content/browser/renderer_host/media/dtls_identity_service_host.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/media/dtls_identity_messages.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/shell/shell.h"
+#include "content/test/content_browser_test.h"
+#include "content/test/content_browser_test_utils.h"
+
+namespace content {
+namespace {
+
+class DTLSIdentityServiceHostForTest : public DTLSIdentityServiceHost {
+ protected:
+ virtual ~DTLSIdentityServiceHostForTest() {}
+
+ private:
+ virtual void OnComplete(const std::string& certificate,
+ const std::string& private_key) OVERRIDE {
+ ASSERT_NE("", certificate);
+ ASSERT_NE("", private_key);
+ }
+};
+
+class DTLSIdentityStoreBrowserTest : public ContentBrowserTest {
+ public:
+ DTLSIdentityStoreBrowserTest() {}
+ virtual ~DTLSIdentityStoreBrowserTest() {}
+
+ void CheckGetOrGenerateIdentity() {
+ GURL url("http://google.com");
+ DTLSIdentityMsg_GetOrGenerate msg(url, "b", "c");
+ scoped_refptr<DTLSIdentityServiceHostForTest> host =
+ new DTLSIdentityServiceHostForTest();
+ bool ok = true;
+ host->OnMessageReceived(msg, &ok);
+ ASSERT_EQ(true, ok);
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(DTLSIdentityStoreBrowserTest, GetOrGenerate) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&DTLSIdentityStoreBrowserTest::CheckGetOrGenerateIdentity,
+ base::Unretained(this)));
+ NavigateToURL(shell(), GURL("about:blank"));
+}
+
+} // namespace
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698