| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 attempts to dismiss app launcher view. |
| 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 Loading... |
| 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 } |
| OLD | NEW |