| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 ASSERT_EQ(manifest_.short_name.string(), info_.name); | 47 ASSERT_EQ(manifest_.short_name.string(), info_.name); |
| 48 } | 48 } |
| 49 | 49 |
| 50 TEST_F(ShortcutInfoTest, ShortNameFallsBackToName) { | 50 TEST_F(ShortcutInfoTest, ShortNameFallsBackToName) { |
| 51 manifest_.name = base::NullableString16(base::ASCIIToUTF16("name"), false); | 51 manifest_.name = base::NullableString16(base::ASCIIToUTF16("name"), false); |
| 52 info_.UpdateFromManifest(manifest_); | 52 info_.UpdateFromManifest(manifest_); |
| 53 | 53 |
| 54 ASSERT_EQ(manifest_.name.string(), info_.short_name); | 54 ASSERT_EQ(manifest_.name.string(), info_.short_name); |
| 55 } | 55 } |
| 56 | 56 |
| 57 TEST_F(ShortcutInfoTest, UserTitleBecomesShortName) { | 57 // Test that if a manifest with an empty name and empty short_name is passed, |
| 58 manifest_.short_name = | 58 // that ShortcutInfo::UpdateFromManifest() does not overwrite the current |
| 59 base::NullableString16(base::ASCIIToUTF16("name"), false); | 59 // ShortcutInfo::name and ShortcutInfo::short_name. |
| 60 info_.user_title = base::ASCIIToUTF16("title"); | 60 TEST_F(ShortcutInfoTest, IgnoreEmptyNameAndShortName) { |
| 61 base::string16 initial_name(base::ASCIIToUTF16("name")); |
| 62 base::string16 initial_short_name(base::ASCIIToUTF16("short_name")); |
| 63 |
| 64 manifest_.display = blink::kWebDisplayModeStandalone; |
| 65 info_.name = initial_name; |
| 66 info_.short_name = initial_short_name; |
| 67 manifest_.name = base::NullableString16(base::string16(), false); |
| 61 info_.UpdateFromManifest(manifest_); | 68 info_.UpdateFromManifest(manifest_); |
| 62 | 69 |
| 63 ASSERT_EQ(manifest_.short_name.string(), info_.user_title); | 70 ASSERT_EQ(initial_name, info_.name); |
| 71 ASSERT_EQ(initial_short_name, info_.short_name); |
| 64 } | 72 } |
| OLD | NEW |