| 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 "chrome/browser/android/shortcut_info.h" | 5 #include "chrome/browser/android/shortcut_info.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/public/common/manifest.h" | 10 #include "content/public/common/manifest.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 TEST_F(ShortcutInfoTest, UserTitleBecomesShortName) { | 57 TEST_F(ShortcutInfoTest, UserTitleBecomesShortName) { |
| 58 manifest_.short_name = | 58 manifest_.short_name = |
| 59 base::NullableString16(base::ASCIIToUTF16("name"), false); | 59 base::NullableString16(base::ASCIIToUTF16("name"), false); |
| 60 info_.user_title = base::ASCIIToUTF16("title"); | 60 info_.user_title = base::ASCIIToUTF16("title"); |
| 61 info_.UpdateFromManifest(manifest_); | 61 info_.UpdateFromManifest(manifest_); |
| 62 | 62 |
| 63 ASSERT_EQ(manifest_.short_name.string(), info_.user_title); | 63 ASSERT_EQ(manifest_.short_name.string(), info_.user_title); |
| 64 } | 64 } |
| 65 |
| 66 // Test that if a manifest with an empty name and empty short_name is passed, |
| 67 // that ShortcutInfo::UpdateFromManifest() does not overwrite the current |
| 68 // ShortcutInfo::name and ShortcutInfo::short_name. |
| 69 TEST_F(ShortcutInfoTest, IgnoreEmptyNameAndShortName) { |
| 70 base::string16 initial_name(base::ASCIIToUTF16("initial_name")); |
| 71 base::string16 initial_short_name(base::ASCIIToUTF16("initial_short_name")); |
| 72 |
| 73 info_.name = initial_name; |
| 74 info_.short_name = initial_short_name; |
| 75 manifest_.display = blink::kWebDisplayModeStandalone; |
| 76 manifest_.name = base::NullableString16(base::string16(), false); |
| 77 info_.UpdateFromManifest(manifest_); |
| 78 |
| 79 ASSERT_EQ(initial_name, info_.name); |
| 80 ASSERT_EQ(initial_short_name, info_.short_name); |
| 81 } |
| OLD | NEW |