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

Unified Diff: chrome/test/data/webui/certificate_viewer_ui_test-inl.h

Issue 7861024: Adds testing infrastructure to web_ui_browsertest to support testing HtmlDialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add description of what triggers notifications and why it's not a race condition. Created 9 years, 3 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: chrome/test/data/webui/certificate_viewer_ui_test-inl.h
diff --git a/chrome/test/data/webui/certificate_viewer_ui_test-inl.h b/chrome/test/data/webui/certificate_viewer_ui_test-inl.h
new file mode 100644
index 0000000000000000000000000000000000000000..22d8b6c9e66f391432b5256535666ac9580b8143
--- /dev/null
+++ b/chrome/test/data/webui/certificate_viewer_ui_test-inl.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 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/ui/browser.h"
+#include "chrome/browser/ui/browser_window.h"
+// #include "chrome/browser/ui/webui/chrome_web_ui.h"
+#include "chrome/browser/ui/webui/web_ui_browsertest.h"
+#include "chrome/browser/certificate_viewer.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "chrome/test/base/test_html_dialog_observer.h"
+#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "content/browser/webui/web_ui.h"
+#include "net/base/test_certificate_data.h"
+#include "net/base/x509_certificate.h"
+
+// Test framework for chrome/test/data/webui/certificate_viewer_dialog_test.js.
+class CertificateViewerUITest : public WebUIBrowserTest {
+ public:
+ CertificateViewerUITest();
+ virtual ~CertificateViewerUITest();
+
+ virtual void SetUpOnMainThread() {
Sheridan Rawlins 2011/09/20 16:04:19 private? (I think since the superclass is public,
flackr 2011/09/20 18:24:52 Done.
+ // Need to enable more WebUI when runtime flag is in use.
+ // ChromeWebUI::SetMoreWebUI(true);
+
+ scoped_refptr<net::X509Certificate> google_cert(
+ net::X509Certificate::CreateFromBytes(
+ reinterpret_cast<const char*>(google_der), sizeof(google_der)));
+
+ ASSERT_TRUE(browser());
+ ASSERT_TRUE(browser()->window());
+
+ TestHtmlDialogObserver dialog_observer;
+ ShowCertificateViewer(browser()->window()->GetNativeHandle(), google_cert);
+ WebUI* webui = dialog_observer.GetWebUI();
+ webui->tab_contents()->render_view_host()->SetWebUIProperty(
+ "expectedUrl", chrome::kChromeUICertificateViewerURL);
+ SetWebUIInstance(webui);
+ WebUIBrowserTest::SetUpOnMainThread();
+ }
+};

Powered by Google App Engine
This is Rietveld 408576698