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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_unittest.cc

Issue 1483593002: arc: Hide app list view on ARC app launch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b2_app_list
Patch Set: Rebased Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/chrome_app_list_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include <algorithm> 5 #include <algorithm>
6 #include <map> 6 #include <map>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id); 185 scoped_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(id);
186 ASSERT_NE(nullptr, app_info.get()); 186 ASSERT_NE(nullptr, app_info.get());
187 EXPECT_NE(ready, app_info->ready); 187 EXPECT_NE(ready, app_info->ready);
188 const ArcAppItem* app_item = FindArcItem(id); 188 const ArcAppItem* app_item = FindArcItem(id);
189 ASSERT_NE(nullptr, app_item); 189 ASSERT_NE(nullptr, app_item);
190 EXPECT_NE(ready, app_item->ready()); 190 EXPECT_NE(ready, app_item->ready());
191 } 191 }
192 192
193 } 193 }
194 194
195 AppListControllerDelegate* controller() { return controller_.get(); }
196
195 arc::FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } 197 arc::FakeArcBridgeService* bridge_service() { return bridge_service_.get(); }
196 198
197 const std::vector<arc::AppInfo>& fake_apps() const { return fake_apps_; } 199 const std::vector<arc::AppInfo>& fake_apps() const { return fake_apps_; }
198 200
199 private: 201 private:
200 scoped_ptr<app_list::AppListModel> model_; 202 scoped_ptr<app_list::AppListModel> model_;
201 scoped_ptr<test::TestAppListControllerDelegate> controller_; 203 scoped_ptr<test::TestAppListControllerDelegate> controller_;
202 scoped_ptr<ArcAppModelBuilder> builder_; 204 scoped_ptr<ArcAppModelBuilder> builder_;
203 scoped_ptr<arc::FakeArcBridgeService> bridge_service_; 205 scoped_ptr<arc::FakeArcBridgeService> bridge_service_;
204 std::vector<arc::AppInfo> fake_apps_; 206 std::vector<arc::AppInfo> fake_apps_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 ValidateAppReadyState(fake_apps(), true); 265 ValidateAppReadyState(fake_apps(), true);
264 266
265 // Stopping service does not delete items. It makes them non-ready. 267 // Stopping service does not delete items. It makes them non-ready.
266 bridge_service()->SetStopped(); 268 bridge_service()->SetStopped();
267 // Ids should be the same. 269 // Ids should be the same.
268 EXPECT_EQ(ids, prefs->GetAppIds()); 270 EXPECT_EQ(ids, prefs->GetAppIds());
269 ValidateAppReadyState(fake_apps(), false); 271 ValidateAppReadyState(fake_apps(), false);
270 } 272 }
271 273
272 TEST_F(ArcAppModelBuilderTest, LaunchApps) { 274 TEST_F(ArcAppModelBuilderTest, LaunchApps) {
275 // Disable attemts to dissmis app launcher view.
xiyuan 2015/12/10 05:28:49 nit: attemts -> attempts, dissmis -> dismiss
276 ChromeAppListItem::OverrideAppListControllerDelegateForTesting(controller());
277
273 bridge_service()->SetReady(); 278 bridge_service()->SetReady();
274 bridge_service()->SendRefreshAppList(fake_apps()); 279 bridge_service()->SendRefreshAppList(fake_apps());
275 280
276 // Simulate item activate. 281 // Simulate item activate.
277 const arc::AppInfo& app_first = fake_apps()[0]; 282 const arc::AppInfo& app_first = fake_apps()[0];
278 const arc::AppInfo& app_last = fake_apps()[0]; 283 const arc::AppInfo& app_last = fake_apps()[0];
279 ArcAppItem* item_first = FindArcItem(GetAppId(app_first)); 284 ArcAppItem* item_first = FindArcItem(GetAppId(app_first));
280 ArcAppItem* item_last = FindArcItem(GetAppId(app_last)); 285 ArcAppItem* item_last = FindArcItem(GetAppId(app_last));
281 ASSERT_NE(nullptr, item_first); 286 ASSERT_NE(nullptr, item_first);
282 ASSERT_NE(nullptr, item_last); 287 ASSERT_NE(nullptr, item_last);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 406
402 // Validate that icons are installed, have right content and icon is 407 // Validate that icons are installed, have right content and icon is
403 // refreshed for ARC app item. 408 // refreshed for ARC app item.
404 EXPECT_EQ(true, base::PathExists(icon_path)); 409 EXPECT_EQ(true, base::PathExists(icon_path));
405 410
406 std::string icon_data; 411 std::string icon_data;
407 // Read the file from disk and compare with reference data. 412 // Read the file from disk and compare with reference data.
408 EXPECT_EQ(true, base::ReadFileToString(icon_path, &icon_data)); 413 EXPECT_EQ(true, base::ReadFileToString(icon_path, &icon_data));
409 ASSERT_EQ(icon_data, png_data); 414 ASSERT_EQ(icon_data, png_data);
410 } 415 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/chrome_app_list_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698