| 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 "components/web_modal/web_contents_modal_dialog_manager.h" | 5 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 int next_dialog_id; | 118 int next_dialog_id; |
| 119 std::unique_ptr<TestWebContentsModalDialogManagerDelegate> delegate; | 119 std::unique_ptr<TestWebContentsModalDialogManagerDelegate> delegate; |
| 120 WebContentsModalDialogManager* manager; | 120 WebContentsModalDialogManager* manager; |
| 121 std::unique_ptr<WebContentsModalDialogManager::TestApi> test_api; | 121 std::unique_ptr<WebContentsModalDialogManager::TestApi> test_api; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManagerTest); | 123 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManagerTest); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 SingleWebContentsDialogManager* | |
| 127 WebContentsModalDialogManager::CreateNativeWebModalManager( | |
| 128 gfx::NativeWindow dialog, | |
| 129 SingleWebContentsDialogManagerDelegate* native_delegate) { | |
| 130 NOTREACHED(); | |
| 131 return new TestNativeWebContentsModalDialogManager( | |
| 132 dialog, | |
| 133 native_delegate, | |
| 134 &unused_tracker); | |
| 135 } | |
| 136 | |
| 137 // Test that the dialog is shown immediately when the delegate indicates the web | 126 // Test that the dialog is shown immediately when the delegate indicates the web |
| 138 // contents is visible. | 127 // contents is visible. |
| 139 TEST_F(WebContentsModalDialogManagerTest, WebContentsVisible) { | 128 TEST_F(WebContentsModalDialogManagerTest, WebContentsVisible) { |
| 140 // Dialog should be shown while WebContents is visible. | 129 // Dialog should be shown while WebContents is visible. |
| 141 const gfx::NativeWindow dialog = MakeFakeDialog(); | 130 const gfx::NativeWindow dialog = MakeFakeDialog(); |
| 142 | 131 |
| 143 NativeManagerTracker tracker; | 132 NativeManagerTracker tracker; |
| 144 TestNativeWebContentsModalDialogManager* native_manager = | 133 TestNativeWebContentsModalDialogManager* native_manager = |
| 145 new TestNativeWebContentsModalDialogManager(dialog, manager, &tracker); | 134 new TestNativeWebContentsModalDialogManager(dialog, manager, &tracker); |
| 146 manager->ShowDialogWithManager(dialog, base::WrapUnique(native_manager)); | 135 manager->ShowDialogWithManager(dialog, base::WrapUnique(native_manager)); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 332 |
| 344 test_api->CloseAllDialogs(); | 333 test_api->CloseAllDialogs(); |
| 345 | 334 |
| 346 EXPECT_FALSE(delegate->web_contents_blocked()); | 335 EXPECT_FALSE(delegate->web_contents_blocked()); |
| 347 EXPECT_FALSE(manager->IsDialogActive()); | 336 EXPECT_FALSE(manager->IsDialogActive()); |
| 348 for (int i = 0; i < kWindowCount; i++) | 337 for (int i = 0; i < kWindowCount; i++) |
| 349 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); | 338 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); |
| 350 } | 339 } |
| 351 | 340 |
| 352 } // namespace web_modal | 341 } // namespace web_modal |
| OLD | NEW |