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

Side by Side Diff: chrome/browser/shell_integration_unittest.cc

Issue 255016: GTK: improve app mode .desktop file creation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/shell_integration_linux.cc ('k') | chrome/common/chrome_plugin_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/common/chrome_constants.h" 9 #include "chrome/common/chrome_constants.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 "Icon=/opt/google/chrome/product_logo_48.png\n" 62 "Icon=/opt/google/chrome/product_logo_48.png\n"
63 "Type=Application\n" 63 "Type=Application\n"
64 "Categories=Application;Network;WebBrowser;\n" 64 "Categories=Application;Network;WebBrowser;\n"
65 "MimeType=text/html;text/xml;application/xhtml_xml;\n", 65 "MimeType=text/html;text/xml;application/xhtml_xml;\n",
66 66
67 "#!/usr/bin/env xdg-open\n" 67 "#!/usr/bin/env xdg-open\n"
68 "[Desktop Entry]\n" 68 "[Desktop Entry]\n"
69 "Version=1.0\n" 69 "Version=1.0\n"
70 "Encoding=UTF-8\n" 70 "Encoding=UTF-8\n"
71 "Name=GMail\n" 71 "Name=GMail\n"
72 "Exec=/opt/google/chrome/google-chrome \"--app=http://gmail.com/\"\n" 72 "Exec=/opt/google/chrome/google-chrome --app=\"http://gmail.com/\"\n"
73 "Terminal=false\n" 73 "Terminal=false\n"
74 "Icon=chrome-http__gmail.com\n" 74 "Icon=chrome-http__gmail.com\n"
75 "Type=Application\n" 75 "Type=Application\n"
76 "Categories=Application;Network;WebBrowser;\n" 76 "Categories=Application;Network;WebBrowser;\n"
77 "MimeType=text/html;text/xml;application/xhtml_xml;\n" 77 "MimeType=text/html;text/xml;application/xhtml_xml;\n"
78 }, 78 },
79 79
80 // Make sure we don't insert duplicate shebangs. 80 // Make sure we don't insert duplicate shebangs.
81 { "http://gmail.com", 81 { "http://gmail.com",
82 "GMail", 82 "GMail",
83 "chrome-http__gmail.com", 83 "chrome-http__gmail.com",
84 84
85 "#!/some/shebang\n" 85 "#!/some/shebang\n"
86 "Name=Google Chrome\n" 86 "Name=Google Chrome\n"
87 "Exec=/opt/google/chrome/google-chrome %U\n", 87 "Exec=/opt/google/chrome/google-chrome %U\n",
88 88
89 "#!/usr/bin/env xdg-open\n" 89 "#!/usr/bin/env xdg-open\n"
90 "Name=GMail\n" 90 "Name=GMail\n"
91 "Exec=/opt/google/chrome/google-chrome \"--app=http://gmail.com/\"\n" 91 "Exec=/opt/google/chrome/google-chrome --app=\"http://gmail.com/\"\n"
92 }, 92 },
93 93
94 // Make sure i18n-ed comments are removed. 94 // Make sure i18n-ed comments are removed.
95 { "http://gmail.com", 95 { "http://gmail.com",
96 "GMail", 96 "GMail",
97 "chrome-http__gmail.com", 97 "chrome-http__gmail.com",
98 98
99 "Name=Google Chrome\n" 99 "Name=Google Chrome\n"
100 "Exec=/opt/google/chrome/google-chrome %U\n" 100 "Exec=/opt/google/chrome/google-chrome %U\n"
101 "Comment[pl]=Jakis komentarz.\n", 101 "Comment[pl]=Jakis komentarz.\n",
102 102
103 "#!/usr/bin/env xdg-open\n" 103 "#!/usr/bin/env xdg-open\n"
104 "Name=GMail\n" 104 "Name=GMail\n"
105 "Exec=/opt/google/chrome/google-chrome \"--app=http://gmail.com/\"\n" 105 "Exec=/opt/google/chrome/google-chrome --app=\"http://gmail.com/\"\n"
106 }, 106 },
107 107
108 // Make sure that empty icons are replaced by the chrome icon. 108 // Make sure that empty icons are replaced by the chrome icon.
109 { "http://gmail.com", 109 { "http://gmail.com",
110 "GMail", 110 "GMail",
111 "", 111 "",
112 112
113 "Name=Google Chrome\n" 113 "Name=Google Chrome\n"
114 "Exec=/opt/google/chrome/google-chrome %U\n" 114 "Exec=/opt/google/chrome/google-chrome %U\n"
115 "Comment[pl]=Jakis komentarz.\n" 115 "Comment[pl]=Jakis komentarz.\n"
116 "Icon=/opt/google/chrome/product_logo_48.png\n", 116 "Icon=/opt/google/chrome/product_logo_48.png\n",
117 117
118 "#!/usr/bin/env xdg-open\n" 118 "#!/usr/bin/env xdg-open\n"
119 "Name=GMail\n" 119 "Name=GMail\n"
120 "Exec=/opt/google/chrome/google-chrome \"--app=http://gmail.com/\"\n" 120 "Exec=/opt/google/chrome/google-chrome --app=\"http://gmail.com/\"\n"
121 "Icon=/opt/google/chrome/product_logo_48.png\n" 121 "Icon=/opt/google/chrome/product_logo_48.png\n"
122 }, 122 },
123 123
124 // Now we're starting to be more evil... 124 // Now we're starting to be more evil...
125 { "http://evil.com/evil --join-the-b0tnet", 125 { "http://evil.com/evil --join-the-b0tnet",
126 "Ownz0red\nExec=rm -rf /", 126 "Ownz0red\nExec=rm -rf /",
127 "chrome-http__evil.com_evil", 127 "chrome-http__evil.com_evil",
128 128
129 "Name=Google Chrome\n" 129 "Name=Google Chrome\n"
130 "Exec=/opt/google/chrome/google-chrome %U\n", 130 "Exec=/opt/google/chrome/google-chrome %U\n",
131 131
132 "#!/usr/bin/env xdg-open\n" 132 "#!/usr/bin/env xdg-open\n"
133 "Name=http://evil.com/evil%20--join-the-b0tnet\n" 133 "Name=http://evil.com/evil%20--join-the-b0tnet\n"
134 "Exec=/opt/google/chrome/google-chrome " 134 "Exec=/opt/google/chrome/google-chrome "
135 "\"--app=http://evil.com/evil%%20--join-the-b0tnet\"\n" 135 "--app=\"http://evil.com/evil%%20--join-the-b0tnet\"\n"
136 }, 136 },
137 { "http://evil.com/evil; rm -rf /; \"; rm -rf $HOME >ownz0red", 137 { "http://evil.com/evil; rm -rf /; \"; rm -rf $HOME >ownz0red",
138 "Innocent Title", 138 "Innocent Title",
139 "chrome-http__evil.com_evil", 139 "chrome-http__evil.com_evil",
140 140
141 "Name=Google Chrome\n" 141 "Name=Google Chrome\n"
142 "Exec=/opt/google/chrome/google-chrome %U\n", 142 "Exec=/opt/google/chrome/google-chrome %U\n",
143 143
144 "#!/usr/bin/env xdg-open\n" 144 "#!/usr/bin/env xdg-open\n"
145 "Name=Innocent Title\n" 145 "Name=Innocent Title\n"
146 "Exec=/opt/google/chrome/google-chrome " 146 "Exec=/opt/google/chrome/google-chrome "
147 "\"--app=http://evil.com/evil%%20rm%%20-rf%%20/%%20%%22%%20rm%%20" 147 "--app=\"http://evil.com/evil%%20rm%%20-rf%%20/%%20%%22%%20rm%%20"
148 "-rf%%20HOME%%20%%3Eownz0red\"\n" 148 "-rf%%20HOME%%20%%3Eownz0red\"\n"
149 }, 149 },
150 { "http://evil.com/evil | cat `echo ownz0red` >/dev/null\\", 150 { "http://evil.com/evil | cat `echo ownz0red` >/dev/null\\",
151 "Innocent Title", 151 "Innocent Title",
152 "chrome-http__evil.com_evil", 152 "chrome-http__evil.com_evil",
153 153
154 "Name=Google Chrome\n" 154 "Name=Google Chrome\n"
155 "Exec=/opt/google/chrome/google-chrome %U\n", 155 "Exec=/opt/google/chrome/google-chrome %U\n",
156 156
157 "#!/usr/bin/env xdg-open\n" 157 "#!/usr/bin/env xdg-open\n"
158 "Name=Innocent Title\n" 158 "Name=Innocent Title\n"
159 "Exec=/opt/google/chrome/google-chrome " 159 "Exec=/opt/google/chrome/google-chrome "
160 "\"--app=http://evil.com/evil%%20%%7C%%20cat%%20%%60echo%%20ownz0red" 160 "--app=\"http://evil.com/evil%%20%%7C%%20cat%%20%%60echo%%20ownz0red"
161 "%%60%%20%%3E/dev/null/\"\n" 161 "%%60%%20%%3E/dev/null/\"\n"
162 }, 162 },
163 }; 163 };
164 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); i++) { 164 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); i++) {
165 EXPECT_EQ(test_cases[i].expected_output, 165 EXPECT_EQ(test_cases[i].expected_output,
166 ShellIntegration::GetDesktopFileContents( 166 ShellIntegration::GetDesktopFileContents(
167 test_cases[i].template_contents, 167 test_cases[i].template_contents,
168 GURL(test_cases[i].url), 168 GURL(test_cases[i].url),
169 ASCIIToUTF16(test_cases[i].title), 169 ASCIIToUTF16(test_cases[i].title),
170 test_cases[i].icon_name)); 170 test_cases[i].icon_name));
171 } 171 }
172 } 172 }
173 #endif // defined(OS_LINUX) 173 #endif // defined(OS_LINUX)
OLDNEW
« no previous file with comments | « chrome/browser/shell_integration_linux.cc ('k') | chrome/common/chrome_plugin_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698