| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
| 10 #include "chrome/browser/dom_ui/constrained_html_ui.h" | 10 #include "chrome/browser/dom_ui/constrained_html_ui.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 size->set_height(400); | 43 size->set_height(400); |
| 44 } | 44 } |
| 45 virtual std::string GetDialogArgs() const { | 45 virtual std::string GetDialogArgs() const { |
| 46 return std::string(); | 46 return std::string(); |
| 47 } | 47 } |
| 48 virtual void OnDialogClosed(const std::string& json_retval) { } | 48 virtual void OnDialogClosed(const std::string& json_retval) { } |
| 49 virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { | 49 virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) { |
| 50 if (out_close_dialog) | 50 if (out_close_dialog) |
| 51 *out_close_dialog = true; | 51 *out_close_dialog = true; |
| 52 } | 52 } |
| 53 virtual bool ShouldShowDialogTitle() const { return true; } |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 } // namespace | 56 } // namespace |
| 56 | 57 |
| 57 class ConstrainedHtmlDialogBrowserTest : public InProcessBrowserTest { | 58 class ConstrainedHtmlDialogBrowserTest : public InProcessBrowserTest { |
| 58 public: | 59 public: |
| 59 ConstrainedHtmlDialogBrowserTest() {} | 60 ConstrainedHtmlDialogBrowserTest() {} |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 // Tests that opening/closing the constrained window won't crash it. | 63 // Tests that opening/closing the constrained window won't crash it. |
| 63 IN_PROC_BROWSER_TEST_F(ConstrainedHtmlDialogBrowserTest, BasicTest) { | 64 IN_PROC_BROWSER_TEST_F(ConstrainedHtmlDialogBrowserTest, BasicTest) { |
| 64 // The delegate deletes itself. | 65 // The delegate deletes itself. |
| 65 HtmlDialogUIDelegate* delegate = new TestHtmlDialogUIDelegate(); | 66 HtmlDialogUIDelegate* delegate = new TestHtmlDialogUIDelegate(); |
| 66 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 67 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 67 ASSERT_TRUE(tab_contents != NULL); | 68 ASSERT_TRUE(tab_contents != NULL); |
| 68 | 69 |
| 69 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(browser()->profile(), | 70 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(browser()->profile(), |
| 70 delegate, | 71 delegate, |
| 71 tab_contents); | 72 tab_contents); |
| 72 | 73 |
| 73 ASSERT_EQ(1U, tab_contents->constrained_window_count()); | 74 ASSERT_EQ(1U, tab_contents->constrained_window_count()); |
| 74 } | 75 } |
| OLD | NEW |