0

[iOS][Waffle] Convert CHECK to CHECK NotFatalUntil::M124

Convert all CHECK and DCHECK to be not fatal until M124 in
ios/chrome/browser/ui/search_engine_choice.

Low-Coverage-Reason: TRIVIAL_CHANGE Updating CHECK and DCHECK.
Change-Id: I45a53aa610c7a260ea336f4d04d13a4546aa502c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5192645
Auto-Submit: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: Nicolas Dossou-Gbété <dgn@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1247220}
This commit is contained in:
Jérôme Lebel
2024-01-15 17:03:09 +00:00
committed by Chromium LUCI CQ
parent 28af930268
commit e13832c42e
7 changed files with 20 additions and 13 deletions

@ -119,7 +119,7 @@ CALayer* CreateOmniboxFieldLayer(BOOL isEmpty) {
faviconImage:(UIImage*)image {
self = [super initWithFrame:CGRectMake(0, 0, 0, 0)];
if (self) {
CHECK((!name && !image) || (name && image))
CHECK((!name && !image) || (name && image), base::NotFatalUntil::M124)
<< "name: " << name << ", image: " << image;
_isEmptyFakeOmnibox = !name && !image;
@ -203,7 +203,7 @@ CALayer* CreateOmniboxFieldLayer(BOOL isEmpty) {
#pragma mark - Properties
- (void)setFaviconImage:(UIImage*)faviconImage {
CHECK(!_isEmptyFakeOmnibox);
CHECK(!_isEmptyFakeOmnibox, base::NotFatalUntil::M124);
_faviconImage = faviconImage;
_imageView.image = faviconImage;
}

@ -7,6 +7,7 @@
#import "base/check.h"
#import "base/check_op.h"
#import "base/notreached.h"
#import "base/strings/sys_string_conversions.h"
#import "ios/chrome/browser/shared/ui/symbols/symbols.h"
#import "ios/chrome/browser/ui/search_engine_choice/search_engine_choice_constants.h"
#import "ios/chrome/common/ui/colors/semantic_color_names.h"
@ -334,7 +335,9 @@ constexpr NSTimeInterval kSnippetAnimationDurationInSecond = .3;
#pragma mark - Accessibility
- (NSString*)accessibilityLabel {
CHECK_NE(self.snippetLabel.text.length, 0ul);
CHECK_NE(self.snippetLabel.text.length, 0ul, base::NotFatalUntil::M124)
<< base::SysNSStringToUTF8(self.nameLabel.text) << " "
<< base::SysNSStringToUTF8(self.snippetLabel.text);
switch (_snippetState) {
case SnippetState::kShown:
return [NSString stringWithFormat:@"%@. %@", self.nameLabel.text,
@ -346,7 +349,9 @@ constexpr NSTimeInterval kSnippetAnimationDurationInSecond = .3;
}
- (NSArray<NSString*>*)accessibilityUserInputLabels {
CHECK(self.nameLabel.text);
CHECK_NE(self.nameLabel.text.length, 0ul, base::NotFatalUntil::M124)
<< base::SysNSStringToUTF8(self.nameLabel.text) << " "
<< base::SysNSStringToUTF8(self.snippetLabel.text);
return @[ self.nameLabel.text ];
}

@ -30,7 +30,7 @@ SnippetSearchEngineItem* CreateSnippetSearchEngineItemFromTemplateURL(
const TemplateURL& template_url) {
SnippetSearchEngineItem* item = nil;
// Only works for prepopulated search engines.
CHECK_GT(template_url.prepopulate_id(), 0)
CHECK_GT(template_url.prepopulate_id(), 0, base::NotFatalUntil::M124)
<< base::UTF16ToUTF8(template_url.short_name());
item = [[SnippetSearchEngineItem alloc] initWithType:kItemTypeEnumZero];
// Add the name and snippet to the item.

@ -117,7 +117,7 @@ constexpr CGFloat kTableViewSeparatorLeadingInset = 56;
items = @[ newDefaultEngine ];
}
[self reconfigureCellsForItems:items];
CHECK(self.delegate);
CHECK(self.delegate, base::NotFatalUntil::M124);
[self.delegate selectSearchEngineAtRow:selectedRow];
}

@ -39,8 +39,7 @@ UIFont* GetTitleFontWithTraitCollection(UITraitCollection* trait_collection) {
} else {
text_style = UIFontTextStyleTitle2;
}
DCHECK(text_style);
CHECK(text_style);
UIFontDescriptor* descriptor =
[UIFontDescriptor preferredFontDescriptorWithTextStyle:text_style];
UIFont* font = [UIFont systemFontOfSize:descriptor.pointSize
@ -127,11 +126,15 @@ void UpdatePrimaryButton(UIButton* button,
UIImage* SearchEngineFaviconFromTemplateURL(const TemplateURL& template_url) {
// Only works for prepopulated search engines.
CHECK_GT(template_url.prepopulate_id(), 0)
CHECK_GT(template_url.prepopulate_id(), 0, base::NotFatalUntil::M124)
<< base::UTF16ToUTF8(template_url.short_name());
std::u16string engine_keyword = template_url.data().keyword();
int resource_id = search_engines::GetIconResourceId(engine_keyword);
CHECK_NE(resource_id, -1) << base::UTF16ToUTF8(engine_keyword);
CHECK_NE(resource_id, -1, base::NotFatalUntil::M124)
<< base::UTF16ToUTF8(engine_keyword);
if (resource_id == -1) {
return nil;
}
ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance();
return resource_bundle.GetNativeImageNamed(resource_id).ToUIImage();
}

@ -85,8 +85,7 @@ const char* const kLearnMoreURL = "internal://choice-screen-learn-more";
- (instancetype)initWithSearchEngineTableViewController:
(SearchEngineChoiceTableViewController*)tableViewController {
DCHECK(tableViewController);
CHECK(tableViewController);
self = [super initWithNibName:nil bundle:nil];
if (self) {
_searchEngineTableViewController = tableViewController;

@ -58,7 +58,7 @@
#pragma mark - WhyAmISeeingThisDelegate
- (void)learnMoreDone:(WhyAmISeeingThisViewController*)viewController {
CHECK_EQ(_viewController, viewController);
CHECK_EQ(_viewController, viewController, base::NotFatalUntil::M124);
__weak __typeof(self) weakSelf = self;
[_viewController dismissViewControllerAnimated:YES
completion:^() {