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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
OLDNEW
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/file_util.h" 10 #include "base/file_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 } // namespace 107 } // namespace
108 108
109 TEST(ShellIntegrationTest, GetExistingShortcutLocations) { 109 TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
110 base::FilePath kProfilePath("Default"); 110 base::FilePath kProfilePath("Default");
111 const char kExtensionId[] = "test_extension"; 111 const char kExtensionId[] = "test_extension";
112 const char kTemplateFilename[] = "chrome-test_extension-Default.desktop"; 112 const char kTemplateFilename[] = "chrome-test_extension-Default.desktop";
113 base::FilePath kTemplateFilepath(kTemplateFilename); 113 base::FilePath kTemplateFilepath(kTemplateFilename);
114 const char kNoDisplayDesktopFile[] = "[Desktop Entry]\nNoDisplay=true"; 114 const char kNoDisplayDesktopFile[] = "[Desktop Entry]\nNoDisplay=true";
115 115
116 MessageLoop message_loop; 116 base::MessageLoop message_loop;
117 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop); 117 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop);
118 118
119 // No existing shortcuts. 119 // No existing shortcuts.
120 { 120 {
121 MockEnvironment env; 121 MockEnvironment env;
122 ShellIntegration::ShortcutLocations result = 122 ShellIntegration::ShortcutLocations result =
123 ShellIntegrationLinux::GetExistingShortcutLocations( 123 ShellIntegrationLinux::GetExistingShortcutLocations(
124 &env, kProfilePath, kExtensionId); 124 &env, kProfilePath, kExtensionId);
125 EXPECT_FALSE(result.on_desktop); 125 EXPECT_FALSE(result.on_desktop);
126 EXPECT_FALSE(result.in_applications_menu); 126 EXPECT_FALSE(result.in_applications_menu);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 EXPECT_FALSE(result.hidden); 220 EXPECT_FALSE(result.hidden);
221 } 221 }
222 } 222 }
223 223
224 TEST(ShellIntegrationTest, GetExistingShortcutContents) { 224 TEST(ShellIntegrationTest, GetExistingShortcutContents) {
225 const char kTemplateFilename[] = "shortcut-test.desktop"; 225 const char kTemplateFilename[] = "shortcut-test.desktop";
226 base::FilePath kTemplateFilepath(kTemplateFilename); 226 base::FilePath kTemplateFilepath(kTemplateFilename);
227 const char kTestData1[] = "a magical testing string"; 227 const char kTestData1[] = "a magical testing string";
228 const char kTestData2[] = "a different testing string"; 228 const char kTestData2[] = "a different testing string";
229 229
230 MessageLoop message_loop; 230 base::MessageLoop message_loop;
231 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop); 231 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop);
232 232
233 // Test that it searches $XDG_DATA_HOME/applications. 233 // Test that it searches $XDG_DATA_HOME/applications.
234 { 234 {
235 base::ScopedTempDir temp_dir; 235 base::ScopedTempDir temp_dir;
236 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 236 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
237 237
238 MockEnvironment env; 238 MockEnvironment env;
239 env.Set("XDG_DATA_HOME", temp_dir.path().value()); 239 env.Set("XDG_DATA_HOME", temp_dir.path().value());
240 // Create a file in a non-applications directory. This should be ignored. 240 // Create a file in a non-applications directory. This should be ignored.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { 326 TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) {
327 #if defined(GOOGLE_CHROME_BUILD) 327 #if defined(GOOGLE_CHROME_BUILD)
328 const char kTemplateFilename[] = "google-chrome.desktop"; 328 const char kTemplateFilename[] = "google-chrome.desktop";
329 #else // CHROMIUM_BUILD 329 #else // CHROMIUM_BUILD
330 const char kTemplateFilename[] = "chromium-browser.desktop"; 330 const char kTemplateFilename[] = "chromium-browser.desktop";
331 #endif 331 #endif
332 332
333 const char kTestData[] = "a magical testing string"; 333 const char kTestData[] = "a magical testing string";
334 334
335 MessageLoop message_loop; 335 base::MessageLoop message_loop;
336 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop); 336 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop);
337 337
338 // Just do a simple test. The details are covered by 338 // Just do a simple test. The details are covered by
339 // GetExistingShortcutContents test. 339 // GetExistingShortcutContents test.
340 { 340 {
341 base::ScopedTempDir temp_dir; 341 base::ScopedTempDir temp_dir;
342 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 342 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
343 343
344 MockEnvironment env; 344 MockEnvironment env;
345 env.Set("XDG_DATA_HOME", temp_dir.path().value()); 345 env.Set("XDG_DATA_HOME", temp_dir.path().value());
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 std::string(), 647 std::string(),
648 base::FilePath(), 648 base::FilePath(),
649 ASCIIToUTF16(test_cases[i].title), 649 ASCIIToUTF16(test_cases[i].title),
650 test_cases[i].icon_name, 650 test_cases[i].icon_name,
651 base::FilePath(), 651 base::FilePath(),
652 test_cases[i].nodisplay)); 652 test_cases[i].nodisplay));
653 } 653 }
654 } 654 }
655 655
656 #endif 656 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698