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() 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); | 90 ConstrainedWebDialogBrowserTestObserver observer(new_tab.get()); |
91 dialog_delegate->ReleaseWebContentsOnDialogClose(); | 91 dialog_delegate->ReleaseWebContentsOnDialogClose(); |
92 dialog_delegate->OnDialogCloseFromWebUI(); | 92 dialog_delegate->OnDialogCloseFromWebUI(); |
93 | 93 |
94 ASSERT_FALSE(observer.contents_destroyed()); | 94 ASSERT_FALSE(observer.contents_destroyed()); |
95 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); | 95 EXPECT_FALSE(IsShowingWebContentsModalDialog(web_contents)); |
96 new_tab.reset(); | 96 new_tab.reset(); |
97 EXPECT_TRUE(observer.contents_destroyed()); | 97 EXPECT_TRUE(observer.contents_destroyed()); |
98 } | 98 } |
OLD | NEW |