| 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/single_web_contents_dialog_manager.h" | 10 #include "components/web_modal/single_web_contents_dialog_manager.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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), |
| 91 manager(NULL) { | 91 manager(NULL) { |
| 92 } | 92 } |
| 93 | 93 |
| 94 virtual void SetUp() { | 94 void SetUp() override { |
| 95 content::RenderViewHostTestHarness::SetUp(); | 95 content::RenderViewHostTestHarness::SetUp(); |
| 96 | 96 |
| 97 delegate.reset(new TestWebContentsModalDialogManagerDelegate); | 97 delegate.reset(new TestWebContentsModalDialogManagerDelegate); |
| 98 WebContentsModalDialogManager::CreateForWebContents(web_contents()); | 98 WebContentsModalDialogManager::CreateForWebContents(web_contents()); |
| 99 manager = WebContentsModalDialogManager::FromWebContents(web_contents()); | 99 manager = WebContentsModalDialogManager::FromWebContents(web_contents()); |
| 100 manager->SetDelegate(delegate.get()); | 100 manager->SetDelegate(delegate.get()); |
| 101 test_api.reset(new WebContentsModalDialogManager::TestApi(manager)); | 101 test_api.reset(new WebContentsModalDialogManager::TestApi(manager)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void TearDown() { | 104 void TearDown() override { |
| 105 test_api.reset(); | 105 test_api.reset(); |
| 106 content::RenderViewHostTestHarness::TearDown(); | 106 content::RenderViewHostTestHarness::TearDown(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 NativeWebContentsModalDialog MakeFakeDialog() { | 110 NativeWebContentsModalDialog MakeFakeDialog() { |
| 111 // WebContentsModalDialogManager treats the NativeWebContentsModalDialog as | 111 // WebContentsModalDialogManager treats the NativeWebContentsModalDialog as |
| 112 // an opaque type, so creating fake NativeWebContentsModalDialogs using | 112 // an opaque type, so creating fake NativeWebContentsModalDialogs using |
| 113 // reinterpret_cast is valid. | 113 // reinterpret_cast is valid. |
| 114 return reinterpret_cast<NativeWebContentsModalDialog>(next_dialog_id++); | 114 return reinterpret_cast<NativeWebContentsModalDialog>(next_dialog_id++); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 test_api->CloseAllDialogs(); | 366 test_api->CloseAllDialogs(); |
| 367 | 367 |
| 368 EXPECT_FALSE(delegate->web_contents_blocked()); | 368 EXPECT_FALSE(delegate->web_contents_blocked()); |
| 369 EXPECT_FALSE(manager->IsDialogActive()); | 369 EXPECT_FALSE(manager->IsDialogActive()); |
| 370 for (int i = 0; i < kWindowCount; i++) | 370 for (int i = 0; i < kWindowCount; i++) |
| 371 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); | 371 EXPECT_EQ(NativeManagerTracker::CLOSED, trackers[i].state_); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace web_modal | 374 } // namespace web_modal |
| OLD | NEW |