Commit c179c83c authored by Huanzhong Huang's avatar Huanzhong Huang Committed by Commit Bot

Add CheckTextButtonCellButtonText() into ChromeTableViewControllerTest

To allow checks for |buttonText|.

Change-Id: I367876e36e669b56a2dc4cd436665bd600be398e
Reviewed-on: https://chromium-review.googlesource.com/c/1356716
Commit-Queue: Huanzhong Huang <huanzhong@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614311}
parent 86d9e0e9
......@@ -112,6 +112,19 @@ class ChromeTableViewControllerTest : public BlockCleanupTest {
int section,
int item);
// Verifies that the text button cell at |item| in |section| has the given
// |buttonText|.
void CheckTextButtonCellButtonText(NSString* expected_button_text,
int section,
int item);
// Verifies that the text button cell at |item| in |section| has a
// |buttonText| property which matches the l10n string for
// |expected_button_text_id|.
void CheckTextButtonCellButtonTextWithId(int expected_button_text_id,
int section,
int item);
// For |section|, deletes the item at |item|. |completion_block| is called at
// the end of the call to -performBatchUpdates:completion:.
void DeleteItem(int section, int item, ProceduralBlock completion_block);
......
......@@ -6,6 +6,7 @@
#include "base/logging.h"
#import "base/mac/foundation_util.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_text_item.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h"
......@@ -187,6 +188,23 @@ void ChromeTableViewControllerTest::CheckAccessoryType(
EXPECT_EQ(accessory_type, [text_item accessoryType]);
}
void ChromeTableViewControllerTest::CheckTextButtonCellButtonText(
NSString* expected_button_text,
int section,
int item) {
id text_button_item = GetTableViewItem(section, item);
ASSERT_TRUE([text_button_item respondsToSelector:@selector(buttonText)]);
EXPECT_NSEQ(expected_button_text, [text_button_item buttonText]);
}
void ChromeTableViewControllerTest::CheckTextButtonCellButtonTextWithId(
int expected_button_text_id,
int section,
int item) {
CheckTextButtonCellButtonText(l10n_util::GetNSString(expected_button_text_id),
section, item);
}
void ChromeTableViewControllerTest::DeleteItem(
int section,
int item,
......
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