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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 9 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 explicit ConstrainedWebDialogBrowserTestObserver(WebContents* contents) | 27 explicit ConstrainedWebDialogBrowserTestObserver(WebContents* contents) |
28 : content::WebContentsObserver(contents), | 28 : content::WebContentsObserver(contents), |
29 contents_destroyed_(false) { | 29 contents_destroyed_(false) { |
30 } | 30 } |
31 virtual ~ConstrainedWebDialogBrowserTestObserver() {} | 31 virtual ~ConstrainedWebDialogBrowserTestObserver() {} |
32 | 32 |
33 bool contents_destroyed() { return contents_destroyed_; } | 33 bool contents_destroyed() { return contents_destroyed_; } |
34 | 34 |
35 private: | 35 private: |
36 virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE { | 36 virtual void WebContentsDestroyed() OVERRIDE { |
37 contents_destroyed_ = true; | 37 contents_destroyed_ = true; |
38 } | 38 } |
39 | 39 |
40 bool contents_destroyed_; | 40 bool contents_destroyed_; |
41 }; | 41 }; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest { | 45 class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest { |
46 public: | 46 public: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); | 96 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); |
97 dialog_delegate->ReleaseWebContentsOnDialogClose(); | 97 dialog_delegate->ReleaseWebContentsOnDialogClose(); |
98 dialog_delegate->OnDialogCloseFromWebUI(); | 98 dialog_delegate->OnDialogCloseFromWebUI(); |
99 | 99 |
100 ASSERT_FALSE(observer.contents_destroyed()); | 100 ASSERT_FALSE(observer.contents_destroyed()); |
101 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); | 101 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); |
102 new_tab.reset(); | 102 new_tab.reset(); |
103 EXPECT_TRUE(observer.contents_destroyed()); | 103 EXPECT_TRUE(observer.contents_destroyed()); |
104 } | 104 } |
OLD | NEW |