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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 item_first->Activate(0); | 283 item_first->Activate(0); |
284 item_last->Activate(0); | 284 item_last->Activate(0); |
285 item_first->Activate(0); | 285 item_first->Activate(0); |
286 | 286 |
287 const ScopedVector<arc::FakeArcBridgeService::Request>& launch_requests = | 287 const ScopedVector<arc::FakeArcBridgeService::Request>& launch_requests = |
288 bridge_service()->launch_requests(); | 288 bridge_service()->launch_requests(); |
289 EXPECT_EQ(static_cast<size_t>(3), launch_requests.size()); | 289 EXPECT_EQ(static_cast<size_t>(3), launch_requests.size()); |
290 EXPECT_EQ(true, launch_requests[0]->IsForApp(app_first)); | 290 EXPECT_EQ(true, launch_requests[0]->IsForApp(app_first)); |
291 EXPECT_EQ(true, launch_requests[1]->IsForApp(app_last)); | 291 EXPECT_EQ(true, launch_requests[1]->IsForApp(app_last)); |
292 EXPECT_EQ(true, launch_requests[2]->IsForApp(app_first)); | 292 EXPECT_EQ(true, launch_requests[2]->IsForApp(app_first)); |
| 293 |
| 294 // Test an attempt to launch of a not-ready app. |
| 295 bridge_service()->SendRefreshAppList(std::vector<arc::AppInfo>()); |
| 296 item_first = FindArcItem(GetAppId(app_first)); |
| 297 ASSERT_NE(nullptr, item_first); |
| 298 size_t launch_request_count_before = |
| 299 bridge_service()->launch_requests().size(); |
| 300 item_first->Activate(0); |
| 301 // Number of launch requests must not change. |
| 302 EXPECT_EQ(launch_request_count_before, |
| 303 bridge_service()->launch_requests().size()); |
293 } | 304 } |
294 | 305 |
295 TEST_F(ArcAppModelBuilderTest, RequestIcons) { | 306 TEST_F(ArcAppModelBuilderTest, RequestIcons) { |
296 // Make sure we are on UI thread. | 307 // Make sure we are on UI thread. |
297 ASSERT_EQ(true, | 308 ASSERT_EQ(true, |
298 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 309 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
299 | 310 |
300 bridge_service()->SetReady(); | 311 bridge_service()->SetReady(); |
301 bridge_service()->SendRefreshAppList(fake_apps()); | 312 bridge_service()->SendRefreshAppList(fake_apps()); |
302 | 313 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 401 |
391 // Validate that icons are installed, have right content and icon is | 402 // Validate that icons are installed, have right content and icon is |
392 // refreshed for ARC app item. | 403 // refreshed for ARC app item. |
393 EXPECT_EQ(true, base::PathExists(icon_path)); | 404 EXPECT_EQ(true, base::PathExists(icon_path)); |
394 | 405 |
395 std::string icon_data; | 406 std::string icon_data; |
396 // Read the file from disk and compare with reference data. | 407 // Read the file from disk and compare with reference data. |
397 EXPECT_EQ(true, base::ReadFileToString(icon_path, &icon_data)); | 408 EXPECT_EQ(true, base::ReadFileToString(icon_path, &icon_data)); |
398 ASSERT_EQ(icon_data, png_data); | 409 ASSERT_EQ(icon_data, png_data); |
399 } | 410 } |
OLD | NEW |