Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: components/web_modal/web_contents_modal_dialog_manager_unittest.cc

Issue 290693002: Remove the unused close_on_interstitial_webui setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove the unused close_on_interstitial_webui setting. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/web_modal/web_contents_modal_dialog_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/single_web_contents_dialog_manager.h" 10 #include "components/web_modal/single_web_contents_dialog_manager.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 test_api->WebContentsWasShown(); 235 test_api->WebContentsWasShown();
236 236
237 EXPECT_TRUE(manager->IsDialogActive()); 237 EXPECT_TRUE(manager->IsDialogActive());
238 EXPECT_TRUE(delegate->web_contents_blocked()); 238 EXPECT_TRUE(delegate->web_contents_blocked());
239 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); 239 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_);
240 240
241 native_manager->StopTracking(); 241 native_manager->StopTracking();
242 } 242 }
243 243
244 // Test that attaching an interstitial page closes dialogs configured to close. 244 // Test that attaching an interstitial page closes all dialogs.
245 TEST_F(WebContentsModalDialogManagerTest, InterstitialPage) { 245 TEST_F(WebContentsModalDialogManagerTest, InterstitialPage) {
246 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(); 246 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog();
247 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(); 247 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog();
248 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog();
249 248
250 NativeManagerTracker tracker1; 249 NativeManagerTracker tracker1;
251 NativeManagerTracker tracker2; 250 NativeManagerTracker tracker2;
252 NativeManagerTracker tracker3;
253 TestNativeWebContentsModalDialogManager* native_manager1 = 251 TestNativeWebContentsModalDialogManager* native_manager1 =
254 new TestNativeWebContentsModalDialogManager(dialog1, manager, &tracker1); 252 new TestNativeWebContentsModalDialogManager(dialog1, manager, &tracker1);
255 TestNativeWebContentsModalDialogManager* native_manager2 = 253 TestNativeWebContentsModalDialogManager* native_manager2 =
256 new TestNativeWebContentsModalDialogManager(dialog2, manager, &tracker2); 254 new TestNativeWebContentsModalDialogManager(dialog2, manager, &tracker2);
257 TestNativeWebContentsModalDialogManager* native_manager3 =
258 new TestNativeWebContentsModalDialogManager(dialog3, manager, &tracker3);
259 manager->ShowDialogWithManager(dialog1, 255 manager->ShowDialogWithManager(dialog1,
260 scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); 256 scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass());
261 manager->ShowDialogWithManager(dialog2, 257 manager->ShowDialogWithManager(dialog2,
262 scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); 258 scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass());
263 manager->ShowDialogWithManager(dialog3,
264 scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass());
265
266 #if defined(OS_WIN) || defined(USE_AURA)
267 manager->SetCloseOnInterstitialPage(dialog2, false);
268 #else
269 // TODO(wittman): Remove this section once Mac is changed to close on
270 // interstitial pages by default.
271 manager->SetCloseOnInterstitialPage(dialog1, true);
272 manager->SetCloseOnInterstitialPage(dialog3, true);
273 #endif
274 259
275 test_api->DidAttachInterstitialPage(); 260 test_api->DidAttachInterstitialPage();
276 261
262 #if defined(USE_AURA)
277 EXPECT_EQ(NativeManagerTracker::CLOSED, tracker1.state_); 263 EXPECT_EQ(NativeManagerTracker::CLOSED, tracker1.state_);
278 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker2.state_); 264 EXPECT_EQ(NativeManagerTracker::CLOSED, tracker2.state_);
279 EXPECT_EQ(NativeManagerTracker::CLOSED, tracker3.state_); 265 #else
266 EXPECT_EQ(NativeManagerTracker::SHOWN, tracker1.state_);
267 EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker2.state_);
268 #endif
269
280 EXPECT_TRUE(tracker1.was_shown_); 270 EXPECT_TRUE(tracker1.was_shown_);
281 EXPECT_TRUE(tracker2.was_shown_); 271 EXPECT_FALSE(tracker2.was_shown_);
282 EXPECT_FALSE(tracker3.was_shown_);
283 272
284 native_manager2->StopTracking(); 273 native_manager2->StopTracking();
Mike Wittman 2014/05/16 21:37:32 This should be something like: #if !defined(USE_A
msw 2014/05/16 22:38:29 Done.
285 } 274 }
286 275
287 276
288 // Test that the first dialog is always shown, regardless of the order in which 277 // Test that the first dialog is always shown, regardless of the order in which
289 // dialogs are closed. 278 // dialogs are closed.
290 TEST_F(WebContentsModalDialogManagerTest, CloseDialogs) { 279 TEST_F(WebContentsModalDialogManagerTest, CloseDialogs) {
291 // The front dialog is always shown regardless of dialog close order. 280 // The front dialog is always shown regardless of dialog close order.
292 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(); 281 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog();
293 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(); 282 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog();
294 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(); 283 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 367
379 test_api->CloseAllDialogs(); 368 test_api->CloseAllDialogs();
380 369
381 EXPECT_FALSE(delegate->web_contents_blocked()); 370 EXPECT_FALSE(delegate->web_contents_blocked());
382 EXPECT_FALSE(manager->IsDialogActive()); 371 EXPECT_FALSE(manager->IsDialogActive());
383 for (int i = 0; i < kWindowCount; i++) 372 for (int i = 0; i < kWindowCount; i++)
384 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); 373 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_);
385 } 374 }
386 375
387 } // namespace web_modal 376 } // namespace web_modal
OLDNEW
« no previous file with comments | « components/web_modal/web_contents_modal_dialog_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698