OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/shell_integration.h" | 5 #include "chrome/browser/shell_integration.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 GURL(test_cases[i].url), | 464 GURL(test_cases[i].url), |
465 std::string(), | 465 std::string(), |
466 base::FilePath(), | 466 base::FilePath(), |
467 ASCIIToUTF16(test_cases[i].title), | 467 ASCIIToUTF16(test_cases[i].title), |
468 test_cases[i].icon_name, | 468 test_cases[i].icon_name, |
469 base::FilePath(), | 469 base::FilePath(), |
470 test_cases[i].nodisplay)); | 470 test_cases[i].nodisplay)); |
471 } | 471 } |
472 } | 472 } |
473 | 473 |
| 474 TEST(ShellIntegrationTest, GetDirectoryFileContents) { |
| 475 const struct { |
| 476 const char* title; |
| 477 const char* icon_name; |
| 478 const char* expected_output; |
| 479 } test_cases[] = { |
| 480 // Real-world case. |
| 481 { "Chrome Apps", |
| 482 "chrome-apps", |
| 483 |
| 484 "[Desktop Entry]\n" |
| 485 "Version=1.0\n" |
| 486 "Type=Directory\n" |
| 487 "Name=Chrome Apps\n" |
| 488 "Icon=chrome-apps\n" |
| 489 }, |
| 490 |
| 491 // Make sure that empty icons are replaced by the chrome icon. |
| 492 { "Chrome Apps", |
| 493 "", |
| 494 |
| 495 "[Desktop Entry]\n" |
| 496 "Version=1.0\n" |
| 497 "Type=Directory\n" |
| 498 "Name=Chrome Apps\n" |
| 499 "Icon=chromium-browser\n" |
| 500 }, |
| 501 }; |
| 502 |
| 503 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); i++) { |
| 504 SCOPED_TRACE(i); |
| 505 EXPECT_EQ( |
| 506 test_cases[i].expected_output, |
| 507 ShellIntegrationLinux::GetDirectoryFileContents( |
| 508 ASCIIToUTF16(test_cases[i].title), |
| 509 test_cases[i].icon_name)); |
| 510 } |
| 511 } |
| 512 |
474 #endif | 513 #endif |
OLD | NEW |