| 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/browser/ui/web_contents_modal_dialog.h" | 5 #include "chrome/browser/ui/web_contents_modal_dialog.h" |
| 6 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 6 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
| 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "content/public/test/test_browser_thread.h" | 8 #include "content/public/test/test_browser_thread.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual gfx::NativeWindow GetNativeWindow() { | 45 virtual gfx::NativeWindow GetNativeWindow() { |
| 46 NOTREACHED(); | 46 NOTREACHED(); |
| 47 return NULL; | 47 return NULL; |
| 48 } | 48 } |
| 49 virtual ~WebContentsModalDialogCloseTest() {} | 49 virtual ~WebContentsModalDialogCloseTest() {} |
| 50 | 50 |
| 51 int close_count; | 51 int close_count; |
| 52 content::WebContents* web_contents_; | 52 content::WebContents* web_contents_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 TEST_F(WebContentsModalDialogManagerTest, ConstrainedWindows) { | 55 TEST_F(WebContentsModalDialogManagerTest, WebContentsModalDialogs) { |
| 56 WebContentsModalDialogCloseTest window(web_contents()); | 56 WebContentsModalDialogCloseTest window(web_contents()); |
| 57 window.close_count = 0; | 57 window.close_count = 0; |
| 58 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 58 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 59 WebContentsModalDialogManager::FromWebContents(web_contents()); | 59 WebContentsModalDialogManager::FromWebContents(web_contents()); |
| 60 WebContentsModalDialogManager::TestApi test_api( |
| 61 web_contents_modal_dialog_manager); |
| 62 |
| 63 test_api.ResetUIDelegate(NULL); |
| 60 | 64 |
| 61 const int kWindowCount = 4; | 65 const int kWindowCount = 4; |
| 62 for (int i = 0; i < kWindowCount; i++) | 66 for (int i = 0; i < kWindowCount; i++) |
| 63 web_contents_modal_dialog_manager->AddDialog(&window); | 67 web_contents_modal_dialog_manager->AddDialog(&window); |
| 64 EXPECT_EQ(window.close_count, 0); | 68 EXPECT_EQ(window.close_count, 0); |
| 65 | 69 |
| 66 WebContentsModalDialogManager::TestApi test_api( | |
| 67 web_contents_modal_dialog_manager); | |
| 68 test_api.CloseAllDialogs(); | 70 test_api.CloseAllDialogs(); |
| 69 EXPECT_EQ(window.close_count, kWindowCount); | 71 EXPECT_EQ(window.close_count, kWindowCount); |
| 70 } | 72 } |
| OLD | NEW |