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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 class ConstrainedWebDialogBrowserTestObserver | 24 class ConstrainedWebDialogBrowserTestObserver |
25 : public content::WebContentsObserver { | 25 : public content::WebContentsObserver { |
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 ~ConstrainedWebDialogBrowserTestObserver() override {} |
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() override { | 36 void WebContentsDestroyed() override { contents_destroyed_ = true; } |
37 contents_destroyed_ = true; | |
38 } | |
39 | 37 |
40 bool contents_destroyed_; | 38 bool contents_destroyed_; |
41 }; | 39 }; |
42 | 40 |
43 } // namespace | 41 } // namespace |
44 | 42 |
45 class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest { | 43 class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest { |
46 public: | 44 public: |
47 ConstrainedWebDialogBrowserTest() {} | 45 ConstrainedWebDialogBrowserTest() {} |
48 | 46 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 87 |
90 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); | 88 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); |
91 dialog_delegate->ReleaseWebContentsOnDialogClose(); | 89 dialog_delegate->ReleaseWebContentsOnDialogClose(); |
92 dialog_delegate->OnDialogCloseFromWebUI(); | 90 dialog_delegate->OnDialogCloseFromWebUI(); |
93 | 91 |
94 ASSERT_FALSE(observer.contents_destroyed()); | 92 ASSERT_FALSE(observer.contents_destroyed()); |
95 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); | 93 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); |
96 new_tab.reset(); | 94 new_tab.reset(); |
97 EXPECT_TRUE(observer.contents_destroyed()); | 95 EXPECT_TRUE(observer.contents_destroyed()); |
98 } | 96 } |
OLD | NEW |