OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/web/repost_form_tab_helper.h" | 5 #import "ios/chrome/browser/web/repost_form_tab_helper.h" |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 web_state_->SetView(view); | 44 web_state_->SetView(view); |
45 web_state_->SetWebUsageEnabled(true); | 45 web_state_->SetWebUsageEnabled(true); |
46 | 46 |
47 RepostFormTabHelper::CreateForWebState(web_state_.get()); | 47 RepostFormTabHelper::CreateForWebState(web_state_.get()); |
48 } | 48 } |
49 | 49 |
50 // Presents a repost form dialog using RepostFormTabHelperTest. | 50 // Presents a repost form dialog using RepostFormTabHelperTest. |
51 void PresentDialog() { | 51 void PresentDialog() { |
52 ASSERT_FALSE(GetAlertController()); | 52 ASSERT_FALSE(GetAlertController()); |
53 auto helper = RepostFormTabHelper::FromWebState(web_state_.get()); | 53 auto* helper = RepostFormTabHelper::FromWebState(web_state_.get()); |
54 helper->PresentDialog(location_, base::Bind(&IgnoreBool)); | 54 helper->PresentDialog(location_, base::Bind(&IgnoreBool)); |
55 ASSERT_TRUE(GetAlertController()); | 55 ASSERT_TRUE(GetAlertController()); |
56 } | 56 } |
57 | 57 |
58 // Return presented view controller as UIAlertController. | 58 // Return presented view controller as UIAlertController. |
59 UIAlertController* GetAlertController() const { | 59 UIAlertController* GetAlertController() const { |
60 return base::mac::ObjCCastStrict<UIAlertController>( | 60 return base::mac::ObjCCastStrict<UIAlertController>( |
61 view_controller_.presentedViewController); | 61 view_controller_.presentedViewController); |
62 } | 62 } |
63 | 63 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 // Tests that dialog is dismissed after provisional navigation has started. | 99 // Tests that dialog is dismissed after provisional navigation has started. |
100 TEST_F(RepostFormTabHelperTest, DismissingOnNavigationStart) { | 100 TEST_F(RepostFormTabHelperTest, DismissingOnNavigationStart) { |
101 PresentDialog(); | 101 PresentDialog(); |
102 web_state_->OnProvisionalNavigationStarted(GURL()); | 102 web_state_->OnProvisionalNavigationStarted(GURL()); |
103 base::test::ios::WaitUntilCondition(^{ | 103 base::test::ios::WaitUntilCondition(^{ |
104 return GetAlertController() != nil; | 104 return GetAlertController() != nil; |
105 }); | 105 }); |
106 } | 106 } |
OLD | NEW |