| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 11 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 12 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 12 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 13 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_view.h" | 17 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 21 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 60 |
| 60 class ConstrainedHtmlDialogBrowserTest : public InProcessBrowserTest { | 61 class ConstrainedHtmlDialogBrowserTest : public InProcessBrowserTest { |
| 61 public: | 62 public: |
| 62 ConstrainedHtmlDialogBrowserTest() {} | 63 ConstrainedHtmlDialogBrowserTest() {} |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 // Tests that opening/closing the constrained window won't crash it. | 66 // Tests that opening/closing the constrained window won't crash it. |
| 66 IN_PROC_BROWSER_TEST_F(ConstrainedHtmlDialogBrowserTest, BasicTest) { | 67 IN_PROC_BROWSER_TEST_F(ConstrainedHtmlDialogBrowserTest, BasicTest) { |
| 67 // The delegate deletes itself. | 68 // The delegate deletes itself. |
| 68 HtmlDialogUIDelegate* delegate = new TestHtmlDialogUIDelegate(); | 69 HtmlDialogUIDelegate* delegate = new TestHtmlDialogUIDelegate(); |
| 69 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 70 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); |
| 70 ASSERT_TRUE(tab_contents != NULL); | 71 ASSERT_TRUE(wrapper != NULL); |
| 71 | 72 |
| 72 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(browser()->profile(), | 73 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(browser()->profile(), |
| 73 delegate, | 74 delegate, |
| 74 tab_contents); | 75 wrapper); |
| 75 | 76 |
| 76 ASSERT_EQ(1U, tab_contents->constrained_window_count()); | 77 ASSERT_EQ(1U, wrapper->tab_contents()->constrained_window_count()); |
| 77 } | 78 } |
| OLD | NEW |