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

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

Issue 10332231: Remove chrome::NOTIFICATION_WEB_DIALOG_SHOWN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add web_dialog_observer.h to chrome_browser.gypi Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/test_web_dialog_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/certificate_viewer.h" 5 #include "chrome/browser/certificate_viewer.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_window.h" 7 #include "chrome/browser/ui/browser_window.h"
8 #include "chrome/browser/ui/webui/certificate_viewer_webui.h"
8 #include "chrome/browser/ui/webui/web_ui_browsertest.h" 9 #include "chrome/browser/ui/webui/web_ui_browsertest.h"
9 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
10 #include "chrome/test/base/test_web_dialog_observer.h" 11 #include "chrome/test/base/test_web_dialog_observer.h"
11 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_ui.h" 15 #include "content/public/browser/web_ui.h"
15 #include "net/base/test_certificate_data.h" 16 #include "net/base/test_certificate_data.h"
16 #include "net/base/x509_certificate.h" 17 #include "net/base/x509_certificate.h"
17 18
18 // Test framework for chrome/test/data/webui/certificate_viewer_dialog_test.js. 19 // Test framework for chrome/test/data/webui/certificate_viewer_dialog_test.js.
19 class CertificateViewerUITest : public WebUIBrowserTest { 20 class CertificateViewerUITest : public WebUIBrowserTest {
20 public: 21 public:
21 CertificateViewerUITest(); 22 CertificateViewerUITest();
22 virtual ~CertificateViewerUITest(); 23 virtual ~CertificateViewerUITest();
23 24
24 protected: 25 protected:
25 void ShowCertificateViewer(); 26 void ShowCertificateViewer();
26 }; 27 };
27 28
28 void CertificateViewerUITest::ShowCertificateViewer() { 29 void CertificateViewerUITest::ShowCertificateViewer() {
29 scoped_refptr<net::X509Certificate> google_cert( 30 scoped_refptr<net::X509Certificate> google_cert(
30 net::X509Certificate::CreateFromBytes( 31 net::X509Certificate::CreateFromBytes(
31 reinterpret_cast<const char*>(google_der), sizeof(google_der))); 32 reinterpret_cast<const char*>(google_der), sizeof(google_der)));
32 33
33 ASSERT_TRUE(browser()); 34 ASSERT_TRUE(browser());
34 ASSERT_TRUE(browser()->window()); 35 ASSERT_TRUE(browser()->window());
35 36
36 TestWebDialogObserver dialog_observer(this); 37 TestWebDialogObserver dialog_observer(this);
37 ::ShowCertificateViewer(browser()->window()->GetNativeHandle(), google_cert); 38 CertificateViewerDialog* dialog = new CertificateViewerDialog(
39 google_cert);
40 dialog->AddObserver(&dialog_observer);
41 dialog->Show(browser()->window()->GetNativeHandle());
42 dialog->RemoveObserver(&dialog_observer);
38 content::WebUI* webui = dialog_observer.GetWebUI(); 43 content::WebUI* webui = dialog_observer.GetWebUI();
39 webui->GetWebContents()->GetRenderViewHost()->SetWebUIProperty( 44 webui->GetWebContents()->GetRenderViewHost()->SetWebUIProperty(
40 "expectedUrl", chrome::kChromeUICertificateViewerURL); 45 "expectedUrl", chrome::kChromeUICertificateViewerURL);
41 SetWebUIInstance(webui); 46 SetWebUIInstance(webui);
42 } 47 }
OLDNEW
« no previous file with comments | « chrome/test/base/test_web_dialog_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698