Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/android/shortcut_info_unittest.cc

Issue 2948313002: [Android] Suggest page title for homescreen shortcut when Web Manifest is empty (Closed)
Patch Set: Merge branch 'master' into ignore Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/shortcut_info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698