| OLD | NEW |
| 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/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 9 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 11 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | |
| 12 #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" | 11 #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" |
| 13 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "ui/web_dialogs/constrained_web_dialog_ui.h" |
| 18 | 18 |
| 19 using content::WebContents; | 19 using content::WebContents; |
| 20 using ui::ConstrainedWebDialogDelegate; |
| 21 using ui::ConstrainedWebDialogUI; |
| 22 using ui::WebDialogDelegate; |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| 22 | 25 |
| 23 class ConstrainedWebDialogBrowserTestObserver | 26 class ConstrainedWebDialogBrowserTestObserver |
| 24 : public content::WebContentsObserver { | 27 : public content::WebContentsObserver { |
| 25 public: | 28 public: |
| 26 explicit ConstrainedWebDialogBrowserTestObserver(WebContents* contents) | 29 explicit ConstrainedWebDialogBrowserTestObserver(WebContents* contents) |
| 27 : content::WebContentsObserver(contents), | 30 : content::WebContentsObserver(contents), |
| 28 tab_destroyed_(false) { | 31 tab_destroyed_(false) { |
| 29 } | 32 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 93 |
| 91 ConstrainedWebDialogBrowserTestObserver observer(new_tab->web_contents()); | 94 ConstrainedWebDialogBrowserTestObserver observer(new_tab->web_contents()); |
| 92 dialog_delegate->ReleaseTabContentsOnDialogClose(); | 95 dialog_delegate->ReleaseTabContentsOnDialogClose(); |
| 93 dialog_delegate->OnDialogCloseFromWebUI(); | 96 dialog_delegate->OnDialogCloseFromWebUI(); |
| 94 | 97 |
| 95 ASSERT_FALSE(observer.tab_destroyed()); | 98 ASSERT_FALSE(observer.tab_destroyed()); |
| 96 EXPECT_EQ(0U, GetConstrainedWindowCount(wrapper)); | 99 EXPECT_EQ(0U, GetConstrainedWindowCount(wrapper)); |
| 97 new_tab.reset(); | 100 new_tab.reset(); |
| 98 EXPECT_TRUE(observer.tab_destroyed()); | 101 EXPECT_TRUE(observer.tab_destroyed()); |
| 99 } | 102 } |
| OLD | NEW |