Commit ac8a9356 authored by helenlyang's avatar helenlyang Committed by Commit Bot

[ios showcase] Integrated TextBadgeView with Showcase.

This CL adds TextBadgeView to iOS Showcase. This involves adding a
text_badge_view folder to showcase, creating a glue view controller,
and modifying the Showcase configuration file and BUILD.gn files as
necessary.

Since TextBadgeView is currently a stub implementation, Showcase
displays a blank white screen.

BUG=740133.

Review-Url: https://codereview.chromium.org/2967113003
Cr-Commit-Position: refs/heads/master@{#485302}
parent d7d9e946
...@@ -35,6 +35,7 @@ group("features") { ...@@ -35,6 +35,7 @@ group("features") {
"//ios/showcase/settings", "//ios/showcase/settings",
"//ios/showcase/tab", "//ios/showcase/tab",
"//ios/showcase/tab_grid", "//ios/showcase/tab_grid",
"//ios/showcase/text_badge_view",
"//ios/showcase/toolbar", "//ios/showcase/toolbar",
"//ios/showcase/tools_menu", "//ios/showcase/tools_menu",
"//ios/showcase/uikit_table_view_cell", "//ios/showcase/uikit_table_view_cell",
...@@ -75,6 +76,7 @@ ios_eg_test("ios_showcase_egtests") { ...@@ -75,6 +76,7 @@ ios_eg_test("ios_showcase_egtests") {
"//ios/showcase/root:eg_tests", "//ios/showcase/root:eg_tests",
"//ios/showcase/tab:eg_tests", "//ios/showcase/tab:eg_tests",
"//ios/showcase/tab_grid:eg_tests", "//ios/showcase/tab_grid:eg_tests",
"//ios/showcase/text_badge_view:eg_tests",
"//ios/showcase/toolbar:eg_tests", "//ios/showcase/toolbar:eg_tests",
# All shared libraries must have the sanitizer deps to properly link in # All shared libraries must have the sanitizer deps to properly link in
......
...@@ -91,6 +91,11 @@ ...@@ -91,6 +91,11 @@
showcase::kClassForInstantiationKey : @"SCContentWidgetCoordinator", showcase::kClassForInstantiationKey : @"SCContentWidgetCoordinator",
showcase::kUseCaseKey : @"Content Widget", showcase::kUseCaseKey : @"Content Widget",
}, },
@{
showcase::kClassForDisplayKey : @"TextBadgeView",
showcase::kClassForInstantiationKey : @"SCTextBadgeViewController",
showcase::kUseCaseKey : @"Text badge view",
},
]; ];
} }
......
source_set("text_badge_view") {
sources = [
"sc_text_badge_view_controller.h",
"sc_text_badge_view_controller.mm",
]
deps = [
"//ios/chrome/browser/ui/reading_list:reading_list_ui",
]
libs = [ "UIKit.framework" ]
configs += [ "//build/config/compiler:enable_arc" ]
}
source_set("eg_tests") {
testonly = true
sources = [
"sc_text_badge_view_egtest.mm",
]
deps = [
"//ios/chrome/browser/ui/reading_list:reading_list_ui",
"//ios/chrome/test/earl_grey:test_support",
"//ios/showcase/test",
"//ios/third_party/earl_grey",
"//ui/base",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_SHOWCASE_TEXT_BADGE_VIEW_SC_TEXT_BADGE_VIEW_CONTROLLER_H_
#define IOS_SHOWCASE_TEXT_BADGE_VIEW_SC_TEXT_BADGE_VIEW_CONTROLLER_H_
#import <UIKit/UIKit.h>
@interface SCTextBadgeViewController : UIViewController
@end
#endif // IOS_SHOWCASE_TEXT_BADGE_VIEW_SC_TEXT_BADGE_VIEW_CONTROLLER_H_
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/showcase/text_badge_view/sc_text_badge_view_controller.h"
#import "ios/chrome/browser/ui/reading_list/text_badge_view.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation SCTextBadgeViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor grayColor];
TextBadgeView* textBadge = [[TextBadgeView alloc] initWithText:@"TEXT"];
[self.view addSubview:textBadge];
textBadge.bounds = CGRectMake(0.0f, 0.0f, 100.0f, 100.0f);
textBadge.center = self.view.center;
}
@end
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import "ios/showcase/test/showcase_eg_utils.h"
#import "ios/showcase/test/showcase_test_case.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
using ::showcase_utils::Open;
using ::showcase_utils::Close;
}
@interface TextBadgeViewTestCase : ShowcaseTestCase
@end
@implementation TextBadgeViewTestCase
// Tests that the accessibility label matches the display text.
- (void)testTextBadgeAccessibilityLabel {
Open(@"TextBadgeView");
Close();
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment