OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/dialogs/dialog_presenter.h" | 5 #import "ios/chrome/browser/ui/dialogs/dialog_presenter.h" |
6 | 6 |
7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" | 9 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" |
10 #include "ios/web/public/test/test_web_state.h" | 10 #import "ios/web/public/test/fakes/test_web_state.h" |
11 #include "ios/web/public/web_state/web_state_observer.h" | 11 #include "ios/web/public/web_state/web_state_observer.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "testing/gtest_mac.h" | 13 #include "testing/gtest_mac.h" |
14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 // TestWebState subclass that supports the WebStateDestroyed() callback for a | 18 // TestWebState subclass that supports the WebStateDestroyed() callback for a |
19 // single observer. | 19 // single observer. |
20 class DialogPresenterTestWebState : public web::TestWebState { | 20 class DialogPresenterTestWebState : public web::TestWebState { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 completion3_called = YES; | 202 completion3_called = YES; |
203 }]; | 203 }]; |
204 EXPECT_EQ(1U, delegate().presentedWebStates.size()); | 204 EXPECT_EQ(1U, delegate().presentedWebStates.size()); |
205 EXPECT_EQ(&webState1, delegate().presentedWebStates.front()); | 205 EXPECT_EQ(&webState1, delegate().presentedWebStates.front()); |
206 // Cancel all dialogs and verify that all |completion_called| were called. | 206 // Cancel all dialogs and verify that all |completion_called| were called. |
207 [presenter() cancelAllDialogs]; | 207 [presenter() cancelAllDialogs]; |
208 EXPECT_TRUE(completion1_called); | 208 EXPECT_TRUE(completion1_called); |
209 EXPECT_TRUE(completion2_called); | 209 EXPECT_TRUE(completion2_called); |
210 EXPECT_TRUE(completion3_called); | 210 EXPECT_TRUE(completion3_called); |
211 } | 211 } |
OLD | NEW |