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 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/web_modal/native_web_contents_modal_dialog_manager.h" | 10 #include "components/web_modal/single_web_contents_dialog_manager.h" |
11 #include "components/web_modal/test_web_contents_modal_dialog_manager_delegate.h
" | 11 #include "components/web_modal/test_web_contents_modal_dialog_manager_delegate.h
" |
12 #include "content/public/test/test_renderer_host.h" | 12 #include "content/public/test/test_renderer_host.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace web_modal { | 15 namespace web_modal { |
16 | 16 |
17 // Tracks persistent state changes of the native WC-modal dialog manager. | 17 // Tracks persistent state changes of the native WC-modal dialog manager. |
18 class NativeManagerTracker { | 18 class NativeManagerTracker { |
19 public: | 19 public: |
20 enum DialogState { | 20 enum DialogState { |
(...skipping 12 matching lines...) Expand all Loading... |
33 was_shown_ = true; | 33 was_shown_ = true; |
34 } | 34 } |
35 | 35 |
36 DialogState state_; | 36 DialogState state_; |
37 bool was_shown_; | 37 bool was_shown_; |
38 }; | 38 }; |
39 | 39 |
40 NativeManagerTracker unused_tracker; | 40 NativeManagerTracker unused_tracker; |
41 | 41 |
42 class TestNativeWebContentsModalDialogManager | 42 class TestNativeWebContentsModalDialogManager |
43 : public NativeWebContentsModalDialogManager { | 43 : public SingleWebContentsDialogManager { |
44 public: | 44 public: |
45 TestNativeWebContentsModalDialogManager( | 45 TestNativeWebContentsModalDialogManager( |
46 NativeWebContentsModalDialogManagerDelegate* delegate, | 46 SingleWebContentsDialogManagerDelegate* delegate, |
47 NativeManagerTracker* tracker) | 47 NativeManagerTracker* tracker) |
48 : delegate_(delegate), | 48 : delegate_(delegate), |
49 tracker_(tracker) {} | 49 tracker_(tracker) {} |
50 | 50 |
51 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 51 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
52 if (tracker_) | 52 if (tracker_) |
53 tracker_->SetState(NativeManagerTracker::NOT_SHOWN); | 53 tracker_->SetState(NativeManagerTracker::NOT_SHOWN); |
54 } | 54 } |
55 virtual void ShowDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 55 virtual void ShowDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
56 if (tracker_) | 56 if (tracker_) |
(...skipping 13 matching lines...) Expand all Loading... |
70 virtual void PulseDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 70 virtual void PulseDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
71 } | 71 } |
72 virtual void HostChanged(WebContentsModalDialogHost* new_host) OVERRIDE { | 72 virtual void HostChanged(WebContentsModalDialogHost* new_host) OVERRIDE { |
73 } | 73 } |
74 | 74 |
75 void StopTracking() { | 75 void StopTracking() { |
76 tracker_ = NULL; | 76 tracker_ = NULL; |
77 } | 77 } |
78 | 78 |
79 private: | 79 private: |
80 NativeWebContentsModalDialogManagerDelegate* delegate_; | 80 SingleWebContentsDialogManagerDelegate* delegate_; |
81 NativeManagerTracker* tracker_; | 81 NativeManagerTracker* tracker_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(TestNativeWebContentsModalDialogManager); | 83 DISALLOW_COPY_AND_ASSIGN(TestNativeWebContentsModalDialogManager); |
84 }; | 84 }; |
85 | 85 |
86 class WebContentsModalDialogManagerTest | 86 class WebContentsModalDialogManagerTest |
87 : public content::RenderViewHostTestHarness { | 87 : public content::RenderViewHostTestHarness { |
88 public: | 88 public: |
89 WebContentsModalDialogManagerTest() | 89 WebContentsModalDialogManagerTest() |
90 : next_dialog_id(1), | 90 : next_dialog_id(1), |
(...skipping 24 matching lines...) Expand all Loading... |
115 } | 115 } |
116 | 116 |
117 int next_dialog_id; | 117 int next_dialog_id; |
118 scoped_ptr<TestWebContentsModalDialogManagerDelegate> delegate; | 118 scoped_ptr<TestWebContentsModalDialogManagerDelegate> delegate; |
119 WebContentsModalDialogManager* manager; | 119 WebContentsModalDialogManager* manager; |
120 scoped_ptr<WebContentsModalDialogManager::TestApi> test_api; | 120 scoped_ptr<WebContentsModalDialogManager::TestApi> test_api; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManagerTest); | 122 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManagerTest); |
123 }; | 123 }; |
124 | 124 |
125 NativeWebContentsModalDialogManager* | 125 SingleWebContentsDialogManager* |
126 WebContentsModalDialogManager::CreateNativeManager( | 126 WebContentsModalDialogManager::CreateNativeWebModalManager( |
127 NativeWebContentsModalDialogManagerDelegate* native_delegate) { | 127 SingleWebContentsDialogManagerDelegate* native_delegate) { |
128 NOTREACHED(); | 128 NOTREACHED(); |
129 return new TestNativeWebContentsModalDialogManager(native_delegate, | 129 return new TestNativeWebContentsModalDialogManager(native_delegate, |
130 &unused_tracker); | 130 &unused_tracker); |
131 } | 131 } |
132 | 132 |
133 // Test that the dialog is shown immediately when the delegate indicates the web | 133 // Test that the dialog is shown immediately when the delegate indicates the web |
134 // contents is visible. | 134 // contents is visible. |
135 TEST_F(WebContentsModalDialogManagerTest, WebContentsVisible) { | 135 TEST_F(WebContentsModalDialogManagerTest, WebContentsVisible) { |
136 // Dialog should be shown while WebContents is visible. | 136 // Dialog should be shown while WebContents is visible. |
137 const NativeWebContentsModalDialog dialog = MakeFakeDialog(); | 137 const NativeWebContentsModalDialog dialog = MakeFakeDialog(); |
138 | 138 |
139 NativeManagerTracker tracker; | 139 NativeManagerTracker tracker; |
140 TestNativeWebContentsModalDialogManager* native_manager = | 140 TestNativeWebContentsModalDialogManager* native_manager = |
141 new TestNativeWebContentsModalDialogManager(manager, &tracker); | 141 new TestNativeWebContentsModalDialogManager(manager, &tracker); |
142 manager->ShowDialogWithManager(dialog, | 142 manager->ShowDialogWithManager(dialog, |
143 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager).Pass()); | 143 scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); |
144 | 144 |
145 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); | 145 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); |
146 EXPECT_TRUE(manager->IsDialogActive()); | 146 EXPECT_TRUE(manager->IsDialogActive()); |
147 EXPECT_TRUE(delegate->web_contents_blocked()); | 147 EXPECT_TRUE(delegate->web_contents_blocked()); |
148 EXPECT_TRUE(tracker.was_shown_); | 148 EXPECT_TRUE(tracker.was_shown_); |
149 | 149 |
150 native_manager->StopTracking(); | 150 native_manager->StopTracking(); |
151 } | 151 } |
152 | 152 |
153 // Test that the dialog is not shown immediately when the delegate indicates the | 153 // Test that the dialog is not shown immediately when the delegate indicates the |
154 // web contents is not visible. | 154 // web contents is not visible. |
155 TEST_F(WebContentsModalDialogManagerTest, WebContentsNotVisible) { | 155 TEST_F(WebContentsModalDialogManagerTest, WebContentsNotVisible) { |
156 // Dialog should not be shown while WebContents is not visible. | 156 // Dialog should not be shown while WebContents is not visible. |
157 delegate->set_web_contents_visible(false); | 157 delegate->set_web_contents_visible(false); |
158 | 158 |
159 const NativeWebContentsModalDialog dialog = MakeFakeDialog(); | 159 const NativeWebContentsModalDialog dialog = MakeFakeDialog(); |
160 | 160 |
161 NativeManagerTracker tracker; | 161 NativeManagerTracker tracker; |
162 TestNativeWebContentsModalDialogManager* native_manager = | 162 TestNativeWebContentsModalDialogManager* native_manager = |
163 new TestNativeWebContentsModalDialogManager(manager, &tracker); | 163 new TestNativeWebContentsModalDialogManager(manager, &tracker); |
164 manager->ShowDialogWithManager(dialog, | 164 manager->ShowDialogWithManager(dialog, |
165 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager).Pass()); | 165 scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); |
166 | 166 |
167 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker.state_); | 167 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker.state_); |
168 EXPECT_TRUE(manager->IsDialogActive()); | 168 EXPECT_TRUE(manager->IsDialogActive()); |
169 EXPECT_TRUE(delegate->web_contents_blocked()); | 169 EXPECT_TRUE(delegate->web_contents_blocked()); |
170 EXPECT_FALSE(tracker.was_shown_); | 170 EXPECT_FALSE(tracker.was_shown_); |
171 | 171 |
172 native_manager->StopTracking(); | 172 native_manager->StopTracking(); |
173 } | 173 } |
174 | 174 |
175 // Test that only the first of multiple dialogs is shown. | 175 // Test that only the first of multiple dialogs is shown. |
176 TEST_F(WebContentsModalDialogManagerTest, ShowDialogs) { | 176 TEST_F(WebContentsModalDialogManagerTest, ShowDialogs) { |
177 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(); | 177 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(); |
178 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(); | 178 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(); |
179 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(); | 179 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(); |
180 | 180 |
181 NativeManagerTracker tracker1; | 181 NativeManagerTracker tracker1; |
182 NativeManagerTracker tracker2; | 182 NativeManagerTracker tracker2; |
183 NativeManagerTracker tracker3; | 183 NativeManagerTracker tracker3; |
184 TestNativeWebContentsModalDialogManager* native_manager1 = | 184 TestNativeWebContentsModalDialogManager* native_manager1 = |
185 new TestNativeWebContentsModalDialogManager(manager, &tracker1); | 185 new TestNativeWebContentsModalDialogManager(manager, &tracker1); |
186 TestNativeWebContentsModalDialogManager* native_manager2 = | 186 TestNativeWebContentsModalDialogManager* native_manager2 = |
187 new TestNativeWebContentsModalDialogManager(manager, &tracker2); | 187 new TestNativeWebContentsModalDialogManager(manager, &tracker2); |
188 TestNativeWebContentsModalDialogManager* native_manager3 = | 188 TestNativeWebContentsModalDialogManager* native_manager3 = |
189 new TestNativeWebContentsModalDialogManager(manager, &tracker3); | 189 new TestNativeWebContentsModalDialogManager(manager, &tracker3); |
190 manager->ShowDialogWithManager(dialog1, | 190 manager->ShowDialogWithManager(dialog1, |
191 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager1).Pass()); | 191 scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); |
192 manager->ShowDialogWithManager(dialog2, | 192 manager->ShowDialogWithManager(dialog2, |
193 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager2).Pass()); | 193 scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); |
194 manager->ShowDialogWithManager(dialog3, | 194 manager->ShowDialogWithManager(dialog3, |
195 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager3).Pass()); | 195 scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); |
196 | 196 |
197 EXPECT_TRUE(delegate->web_contents_blocked()); | 197 EXPECT_TRUE(delegate->web_contents_blocked()); |
198 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker1.state_); | 198 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker1.state_); |
199 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker2.state_); | 199 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker2.state_); |
200 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker3.state_); | 200 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker3.state_); |
201 | 201 |
202 native_manager1->StopTracking(); | 202 native_manager1->StopTracking(); |
203 native_manager2->StopTracking(); | 203 native_manager2->StopTracking(); |
204 native_manager3->StopTracking(); | 204 native_manager3->StopTracking(); |
205 } | 205 } |
206 | 206 |
207 // Test that the dialog is shown/hidden when the WebContents is shown/hidden. | 207 // Test that the dialog is shown/hidden when the WebContents is shown/hidden. |
208 TEST_F(WebContentsModalDialogManagerTest, VisibilityObservation) { | 208 TEST_F(WebContentsModalDialogManagerTest, VisibilityObservation) { |
209 const NativeWebContentsModalDialog dialog = MakeFakeDialog(); | 209 const NativeWebContentsModalDialog dialog = MakeFakeDialog(); |
210 | 210 |
211 NativeManagerTracker tracker; | 211 NativeManagerTracker tracker; |
212 TestNativeWebContentsModalDialogManager* native_manager = | 212 TestNativeWebContentsModalDialogManager* native_manager = |
213 new TestNativeWebContentsModalDialogManager(manager, &tracker); | 213 new TestNativeWebContentsModalDialogManager(manager, &tracker); |
214 manager->ShowDialogWithManager(dialog, | 214 manager->ShowDialogWithManager(dialog, |
215 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager).Pass()); | 215 scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); |
216 | 216 |
217 EXPECT_TRUE(manager->IsDialogActive()); | 217 EXPECT_TRUE(manager->IsDialogActive()); |
218 EXPECT_TRUE(delegate->web_contents_blocked()); | 218 EXPECT_TRUE(delegate->web_contents_blocked()); |
219 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); | 219 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); |
220 | 220 |
221 test_api->WebContentsWasHidden(); | 221 test_api->WebContentsWasHidden(); |
222 | 222 |
223 EXPECT_TRUE(manager->IsDialogActive()); | 223 EXPECT_TRUE(manager->IsDialogActive()); |
224 EXPECT_TRUE(delegate->web_contents_blocked()); | 224 EXPECT_TRUE(delegate->web_contents_blocked()); |
225 EXPECT_EQ(NativeManagerTracker::HIDDEN, tracker.state_); | 225 EXPECT_EQ(NativeManagerTracker::HIDDEN, tracker.state_); |
(...skipping 16 matching lines...) Expand all Loading... |
242 NativeManagerTracker tracker1; | 242 NativeManagerTracker tracker1; |
243 NativeManagerTracker tracker2; | 243 NativeManagerTracker tracker2; |
244 NativeManagerTracker tracker3; | 244 NativeManagerTracker tracker3; |
245 TestNativeWebContentsModalDialogManager* native_manager1 = | 245 TestNativeWebContentsModalDialogManager* native_manager1 = |
246 new TestNativeWebContentsModalDialogManager(manager, &tracker1); | 246 new TestNativeWebContentsModalDialogManager(manager, &tracker1); |
247 TestNativeWebContentsModalDialogManager* native_manager2 = | 247 TestNativeWebContentsModalDialogManager* native_manager2 = |
248 new TestNativeWebContentsModalDialogManager(manager, &tracker2); | 248 new TestNativeWebContentsModalDialogManager(manager, &tracker2); |
249 TestNativeWebContentsModalDialogManager* native_manager3 = | 249 TestNativeWebContentsModalDialogManager* native_manager3 = |
250 new TestNativeWebContentsModalDialogManager(manager, &tracker3); | 250 new TestNativeWebContentsModalDialogManager(manager, &tracker3); |
251 manager->ShowDialogWithManager(dialog1, | 251 manager->ShowDialogWithManager(dialog1, |
252 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager1).Pass()); | 252 scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); |
253 manager->ShowDialogWithManager(dialog2, | 253 manager->ShowDialogWithManager(dialog2, |
254 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager2).Pass()); | 254 scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); |
255 manager->ShowDialogWithManager(dialog3, | 255 manager->ShowDialogWithManager(dialog3, |
256 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager3).Pass()); | 256 scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); |
257 | 257 |
258 #if defined(OS_WIN) || defined(USE_AURA) | 258 #if defined(OS_WIN) || defined(USE_AURA) |
259 manager->SetCloseOnInterstitialPage(dialog2, false); | 259 manager->SetCloseOnInterstitialPage(dialog2, false); |
260 #else | 260 #else |
261 // TODO(wittman): Remove this section once Mac is changed to close on | 261 // TODO(wittman): Remove this section once Mac is changed to close on |
262 // interstitial pages by default. | 262 // interstitial pages by default. |
263 manager->SetCloseOnInterstitialPage(dialog1, true); | 263 manager->SetCloseOnInterstitialPage(dialog1, true); |
264 manager->SetCloseOnInterstitialPage(dialog3, true); | 264 manager->SetCloseOnInterstitialPage(dialog3, true); |
265 #endif | 265 #endif |
266 | 266 |
(...skipping 25 matching lines...) Expand all Loading... |
292 NativeManagerTracker tracker4; | 292 NativeManagerTracker tracker4; |
293 TestNativeWebContentsModalDialogManager* native_manager1 = | 293 TestNativeWebContentsModalDialogManager* native_manager1 = |
294 new TestNativeWebContentsModalDialogManager(manager, &tracker1); | 294 new TestNativeWebContentsModalDialogManager(manager, &tracker1); |
295 TestNativeWebContentsModalDialogManager* native_manager2 = | 295 TestNativeWebContentsModalDialogManager* native_manager2 = |
296 new TestNativeWebContentsModalDialogManager(manager, &tracker2); | 296 new TestNativeWebContentsModalDialogManager(manager, &tracker2); |
297 TestNativeWebContentsModalDialogManager* native_manager3 = | 297 TestNativeWebContentsModalDialogManager* native_manager3 = |
298 new TestNativeWebContentsModalDialogManager(manager, &tracker3); | 298 new TestNativeWebContentsModalDialogManager(manager, &tracker3); |
299 TestNativeWebContentsModalDialogManager* native_manager4 = | 299 TestNativeWebContentsModalDialogManager* native_manager4 = |
300 new TestNativeWebContentsModalDialogManager(manager, &tracker4); | 300 new TestNativeWebContentsModalDialogManager(manager, &tracker4); |
301 manager->ShowDialogWithManager(dialog1, | 301 manager->ShowDialogWithManager(dialog1, |
302 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager1).Pass()); | 302 scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); |
303 manager->ShowDialogWithManager(dialog2, | 303 manager->ShowDialogWithManager(dialog2, |
304 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager2).Pass()); | 304 scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); |
305 manager->ShowDialogWithManager(dialog3, | 305 manager->ShowDialogWithManager(dialog3, |
306 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager3).Pass()); | 306 scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); |
307 manager->ShowDialogWithManager(dialog4, | 307 manager->ShowDialogWithManager(dialog4, |
308 scoped_ptr<NativeWebContentsModalDialogManager>(native_manager4).Pass()); | 308 scoped_ptr<SingleWebContentsDialogManager>(native_manager4).Pass()); |
309 | 309 |
310 native_manager1->CloseDialog(dialog1); | 310 native_manager1->CloseDialog(dialog1); |
311 | 311 |
312 EXPECT_TRUE(manager->IsDialogActive()); | 312 EXPECT_TRUE(manager->IsDialogActive()); |
313 EXPECT_TRUE(delegate->web_contents_blocked()); | 313 EXPECT_TRUE(delegate->web_contents_blocked()); |
314 EXPECT_EQ(NativeManagerTracker::CLOSED, tracker1.state_); | 314 EXPECT_EQ(NativeManagerTracker::CLOSED, tracker1.state_); |
315 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker2.state_); | 315 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker2.state_); |
316 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker3.state_); | 316 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker3.state_); |
317 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker4.state_); | 317 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker4.state_); |
318 | 318 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 352 |
353 // Test that CloseAllDialogs does what it says. | 353 // Test that CloseAllDialogs does what it says. |
354 TEST_F(WebContentsModalDialogManagerTest, CloseAllDialogs) { | 354 TEST_F(WebContentsModalDialogManagerTest, CloseAllDialogs) { |
355 const int kWindowCount = 4; | 355 const int kWindowCount = 4; |
356 NativeManagerTracker trackers[kWindowCount]; | 356 NativeManagerTracker trackers[kWindowCount]; |
357 TestNativeWebContentsModalDialogManager* native_managers[kWindowCount]; | 357 TestNativeWebContentsModalDialogManager* native_managers[kWindowCount]; |
358 for (int i = 0; i < kWindowCount; i++) { | 358 for (int i = 0; i < kWindowCount; i++) { |
359 native_managers[i] = | 359 native_managers[i] = |
360 new TestNativeWebContentsModalDialogManager(manager, &(trackers[i])); | 360 new TestNativeWebContentsModalDialogManager(manager, &(trackers[i])); |
361 manager->ShowDialogWithManager(MakeFakeDialog(), | 361 manager->ShowDialogWithManager(MakeFakeDialog(), |
362 scoped_ptr<NativeWebContentsModalDialogManager>( | 362 scoped_ptr<SingleWebContentsDialogManager>( |
363 native_managers[i]).Pass()); | 363 native_managers[i]).Pass()); |
364 } | 364 } |
365 | 365 |
366 for (int i = 0; i < kWindowCount; i++) | 366 for (int i = 0; i < kWindowCount; i++) |
367 EXPECT_NE(NativeManagerTracker::CLOSED, trackers[i].state_); | 367 EXPECT_NE(NativeManagerTracker::CLOSED, trackers[i].state_); |
368 | 368 |
369 test_api->CloseAllDialogs(); | 369 test_api->CloseAllDialogs(); |
370 | 370 |
371 EXPECT_FALSE(delegate->web_contents_blocked()); | 371 EXPECT_FALSE(delegate->web_contents_blocked()); |
372 EXPECT_FALSE(manager->IsDialogActive()); | 372 EXPECT_FALSE(manager->IsDialogActive()); |
373 for (int i = 0; i < kWindowCount; i++) | 373 for (int i = 0; i < kWindowCount; i++) |
374 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); | 374 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); |
375 } | 375 } |
376 | 376 |
377 } // namespace web_modal | 377 } // namespace web_modal |
OLD | NEW |