Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: ui/app_list/cocoa/apps_search_box_controller_unittest.mm

Issue 63283003: Move AppListModel::Users to AppListViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fixes Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/app_list/cocoa/apps_search_box_controller_unittest.mm
diff --git a/ui/app_list/cocoa/apps_search_box_controller_unittest.mm b/ui/app_list/cocoa/apps_search_box_controller_unittest.mm
index d410380c8563bf641115517e5f36e5f1a486aaa8..4317f92a063cf933b37f8d82266a866e5266ff7d 100644
--- a/ui/app_list/cocoa/apps_search_box_controller_unittest.mm
+++ b/ui/app_list/cocoa/apps_search_box_controller_unittest.mm
@@ -34,12 +34,12 @@
- (id)init {
if ((self = [super init])) {
- app_list::AppListModel::Users users(2);
+ app_list::AppListViewDelegate::Users users(2);
users[0].name = ASCIIToUTF16("user1");
users[1].name = ASCIIToUTF16("user2");
users[1].email = ASCIIToUTF16("user2@chromium.org");
users[1].active = true;
- appListModel_.SetUsers(users);
+ appListDelegate_.SetUsers(users);
}
return self;
}
@@ -70,13 +70,16 @@
return &appListModel_;
}
+- (app_list::test::AppListTestViewDelegate*)appListViewDelegate {
+ return &appListViewDelegate_;
+}
+
@end
namespace app_list {
namespace test {
-class AppsSearchBoxControllerTest : public ui::CocoaTest,
- public AppListModelObserver {
+class AppsSearchBoxControllerTest : public ui::CocoaTest {
public:
AppsSearchBoxControllerTest() {
Init();
@@ -88,14 +91,12 @@ class AppsSearchBoxControllerTest : public ui::CocoaTest,
NSMakeRect(0, 0, 400, 100)]);
delegate_.reset([[TestAppsSearchBoxDelegate alloc] init]);
[apps_search_box_controller_ setDelegate:delegate_];
- [delegate_ appListModel]->AddObserver(this);
ui::CocoaTest::SetUp();
[[test_window() contentView] addSubview:[apps_search_box_controller_ view]];
}
virtual void TearDown() OVERRIDE {
- [delegate_ appListModel]->RemoveObserver(this);
[apps_search_box_controller_ setDelegate:nil];
ui::CocoaTest::TearDown();
}
@@ -108,13 +109,6 @@ class AppsSearchBoxControllerTest : public ui::CocoaTest,
}
protected:
- // Overridden from app_list::AppListModelObserver:
- virtual void OnAppListModelUsersChanged() OVERRIDE {
- [apps_search_box_controller_ rebuildMenu];
- }
-
- virtual void OnAppListModelSigninStatusChanged() OVERRIDE {}
-
base::scoped_nsobject<TestAppsSearchBoxDelegate> delegate_;
base::scoped_nsobject<AppsSearchBoxController> apps_search_box_controller_;
@@ -163,7 +157,8 @@ TEST_F(AppsSearchBoxControllerTest, SearchBoxModel) {
TEST_F(AppsSearchBoxControllerTest, SearchBoxMenuSingleUser) {
// Set a single user. We need to set the delegate again because the
// AppListModel observer isn't hooked up in these tests.
- [delegate_ appListModel]->SetUsers(app_list::AppListModel::Users(1));
+ [delegate_ appListViewDelegate]->SetUsers(
+ app_list::AppListViewDelegate::Users(1));
[apps_search_box_controller_ setDelegate:delegate_];
NSPopUpButton* menu_control = [apps_search_box_controller_ menuControl];
@@ -186,8 +181,8 @@ TEST_F(AppsSearchBoxControllerTest, SearchBoxMenuSingleUser) {
// Test the popup menu items for the multi-profile case.
TEST_F(AppsSearchBoxControllerTest, SearchBoxMenu) {
- const app_list::AppListModel::Users& users =
- [delegate_ appListModel]->users();
+ const app_list::AppListViewDelegate::Users& users =
+ [delegate_ appListViewDelegate]->GetUsers();
NSPopUpButton* menu_control = [apps_search_box_controller_ menuControl];
EXPECT_TRUE([apps_search_box_controller_ appListMenu]);
ui::MenuModel* menu_model
@@ -235,7 +230,8 @@ TEST_F(AppsSearchBoxControllerTest, SearchBoxMenu) {
// Test adding another user, and changing an existing one.
TEST_F(AppsSearchBoxControllerTest, SearchBoxMenuChangingUsers) {
- app_list::AppListModel::Users users = [delegate_ appListModel]->users();
+ app_list::AppListViewDelegate::Users users =
+ [delegate_ appListViewDelegate]->GetUsers();
EXPECT_EQ(2u, users.size());
ui::MenuModel* menu_model
= [apps_search_box_controller_ appListMenu]->menu_model();
@@ -248,10 +244,10 @@ TEST_F(AppsSearchBoxControllerTest, SearchBoxMenuChangingUsers) {
[[[menu_control menu] itemAtIndex:1] title]);
users[0].name = ASCIIToUTF16("renamed user");
- app_list::AppListModel::User new_user;
+ app_list::AppListViewDelegate::User new_user;
new_user.name = ASCIIToUTF16("user3");
users.push_back(new_user);
- [delegate_ appListModel]->SetUsers(users);
+ [delegate_ appListViewDelegate]->SetUsers(users);
// Should now be an extra item, and it should have correct titles.
EXPECT_EQ(3, [[menu_control menu] numberOfItems] - non_user_items);

Powered by Google App Engine
This is Rietveld 408576698