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

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: rebase again Created 7 years, 6 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/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 } // namespace 72 } // namespace
73 73
74 TEST(ShellIntegrationTest, GetExistingShortcutLocations) { 74 TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
75 base::FilePath kProfilePath("Default"); 75 base::FilePath kProfilePath("Default");
76 const char kExtensionId[] = "test_extension"; 76 const char kExtensionId[] = "test_extension";
77 const char kTemplateFilename[] = "chrome-test_extension-Default.desktop"; 77 const char kTemplateFilename[] = "chrome-test_extension-Default.desktop";
78 base::FilePath kTemplateFilepath(kTemplateFilename); 78 base::FilePath kTemplateFilepath(kTemplateFilename);
79 const char kNoDisplayDesktopFile[] = "[Desktop Entry]\nNoDisplay=true"; 79 const char kNoDisplayDesktopFile[] = "[Desktop Entry]\nNoDisplay=true";
80 80
81 MessageLoop message_loop; 81 base::MessageLoop message_loop;
82 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop); 82 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop);
83 83
84 // No existing shortcuts. 84 // No existing shortcuts.
85 { 85 {
86 MockEnvironment env; 86 MockEnvironment env;
87 ShellIntegration::ShortcutLocations result = 87 ShellIntegration::ShortcutLocations result =
88 ShellIntegrationLinux::GetExistingShortcutLocations( 88 ShellIntegrationLinux::GetExistingShortcutLocations(
89 &env, kProfilePath, kExtensionId); 89 &env, kProfilePath, kExtensionId);
90 EXPECT_FALSE(result.on_desktop); 90 EXPECT_FALSE(result.on_desktop);
91 EXPECT_FALSE(result.in_applications_menu); 91 EXPECT_FALSE(result.in_applications_menu);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 EXPECT_FALSE(result.hidden); 185 EXPECT_FALSE(result.hidden);
186 } 186 }
187 } 187 }
188 188
189 TEST(ShellIntegrationTest, GetExistingShortcutContents) { 189 TEST(ShellIntegrationTest, GetExistingShortcutContents) {
190 const char kTemplateFilename[] = "shortcut-test.desktop"; 190 const char kTemplateFilename[] = "shortcut-test.desktop";
191 base::FilePath kTemplateFilepath(kTemplateFilename); 191 base::FilePath kTemplateFilepath(kTemplateFilename);
192 const char kTestData1[] = "a magical testing string"; 192 const char kTestData1[] = "a magical testing string";
193 const char kTestData2[] = "a different testing string"; 193 const char kTestData2[] = "a different testing string";
194 194
195 MessageLoop message_loop; 195 base::MessageLoop message_loop;
196 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop); 196 content::TestBrowserThread file_thread(BrowserThread::FILE, &message_loop);
197 197
198 // Test that it searches $XDG_DATA_HOME/applications. 198 // Test that it searches $XDG_DATA_HOME/applications.
199 { 199 {
200 base::ScopedTempDir temp_dir; 200 base::ScopedTempDir temp_dir;
201 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 201 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
202 202
203 MockEnvironment env; 203 MockEnvironment env;
204 env.Set("XDG_DATA_HOME", temp_dir.path().value()); 204 env.Set("XDG_DATA_HOME", temp_dir.path().value());
205 // Create a file in a non-applications directory. This should be ignored. 205 // Create a file in a non-applications directory. This should be ignored.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 SCOPED_TRACE(i); 504 SCOPED_TRACE(i);
505 EXPECT_EQ( 505 EXPECT_EQ(
506 test_cases[i].expected_output, 506 test_cases[i].expected_output,
507 ShellIntegrationLinux::GetDirectoryFileContents( 507 ShellIntegrationLinux::GetDirectoryFileContents(
508 ASCIIToUTF16(test_cases[i].title), 508 ASCIIToUTF16(test_cases[i].title),
509 test_cases[i].icon_name)); 509 test_cases[i].icon_name));
510 } 510 }
511 } 511 }
512 512
513 #endif 513 #endif
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/signin/oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698