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

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

Issue 23981002: Provide configurable closing of web contents modal dialogs on interstitial webui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« 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 <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "components/web_modal/native_web_contents_modal_dialog_manager.h" 8 #include "components/web_modal/native_web_contents_modal_dialog_manager.h"
9 #include "components/web_modal/web_contents_modal_dialog_manager.h" 9 #include "components/web_modal/web_contents_modal_dialog_manager.h"
10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 manager->Observe(content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 225 manager->Observe(content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
226 content::NotificationService::AllSources(), 226 content::NotificationService::AllSources(),
227 content::Details<bool>(&web_contents_visible)); 227 content::Details<bool>(&web_contents_visible));
228 228
229 EXPECT_TRUE(manager->IsShowingDialog()); 229 EXPECT_TRUE(manager->IsShowingDialog());
230 EXPECT_TRUE(delegate->web_contents_blocked()); 230 EXPECT_TRUE(delegate->web_contents_blocked());
231 EXPECT_EQ(TestNativeWebContentsModalDialogManager::SHOWN, 231 EXPECT_EQ(TestNativeWebContentsModalDialogManager::SHOWN,
232 native_manager->GetDialogState(dialog1)); 232 native_manager->GetDialogState(dialog1));
233 } 233 }
234 234
235 TEST_F(WebContentsModalDialogManagerTest, InterstitialWebUI) {
sky 2013/09/05 16:19:19 Add description.
Mike Wittman 2013/09/05 20:22:19 Done.
236 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(1);
237 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(2);
238 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(3);
239
240 manager->ShowDialog(dialog1);
241 manager->ShowDialog(dialog2);
242 manager->ShowDialog(dialog3);
243
244 manager->SetCloseOnInterstitialWebUI(dialog1, true);
245 manager->SetCloseOnInterstitialWebUI(dialog3, true);
246
247 test_api->DidAttachInterstitialPage();
248 EXPECT_EQ(TestNativeWebContentsModalDialogManager::CLOSED,
249 native_manager->GetDialogState(dialog1));
250 EXPECT_EQ(TestNativeWebContentsModalDialogManager::SHOWN,
251 native_manager->GetDialogState(dialog2));
252 EXPECT_EQ(TestNativeWebContentsModalDialogManager::CLOSED,
253 native_manager->GetDialogState(dialog3));
254 }
255
235 TEST_F(WebContentsModalDialogManagerTest, CloseDialogs) { 256 TEST_F(WebContentsModalDialogManagerTest, CloseDialogs) {
236 // The front dialog is always shown regardless of dialog close order. 257 // The front dialog is always shown regardless of dialog close order.
237 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(1); 258 const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(1);
238 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(2); 259 const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(2);
239 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(3); 260 const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(3);
240 const NativeWebContentsModalDialog dialog4 = MakeFakeDialog(4); 261 const NativeWebContentsModalDialog dialog4 = MakeFakeDialog(4);
241 262
242 manager->ShowDialog(dialog1); 263 manager->ShowDialog(dialog1);
243 manager->ShowDialog(dialog2); 264 manager->ShowDialog(dialog2);
244 manager->ShowDialog(dialog3); 265 manager->ShowDialog(dialog3);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 313
293 EXPECT_EQ(0, native_manager->GetCloseCount()); 314 EXPECT_EQ(0, native_manager->GetCloseCount());
294 315
295 test_api->CloseAllDialogs(); 316 test_api->CloseAllDialogs();
296 EXPECT_FALSE(delegate->web_contents_blocked()); 317 EXPECT_FALSE(delegate->web_contents_blocked());
297 EXPECT_FALSE(manager->IsShowingDialog()); 318 EXPECT_FALSE(manager->IsShowingDialog());
298 EXPECT_EQ(kWindowCount, native_manager->GetCloseCount()); 319 EXPECT_EQ(kWindowCount, native_manager->GetCloseCount());
299 } 320 }
300 321
301 } // namespace web_modal 322 } // 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