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

Side by Side Diff: chrome/browser/cocoa/download_util_mac_unittest.mm

Issue 164459: Implement drag and drop of downloads for the Mac downloads page (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Download utility test for Mac OS X.
6
7 #include "base/path_service.h"
8 #include "base/sys_string_conversions.h"
9 #import "chrome/browser/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/cocoa/download_util_mac.h"
11 #include "chrome/common/chrome_paths.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace {
15
16 class DownloadUtilTest : public testing::Test {
17 public:
18 CocoaTestHelper cocoa_helper_;
19 };
20
21 // Ensure adding files to the pasteboard methods works as expected.
22 TEST_F(DownloadUtilTest, AddFileToPasteboardTest) {
23 // Create a pasteboard.
24 NSPasteboard* pasteboard = [NSPasteboard pasteboardWithUniqueName];
25
26 // Get a download test file for addition to the pasteboard.
27 FilePath testPath;
28 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &testPath));
29 FilePath testFile(FILE_PATH_LITERAL("download-test1.lib"));
30 testPath = testPath.Append(testFile);
31
32 // Add a test file to the pasteboard via the download_util method.
33 download_util::AddFileToPasteboard(pasteboard, testPath);
34
35 // Test to see that the object type for dragging files is available.
36 NSArray* types = [NSArray arrayWithObject:NSFilenamesPboardType];
37 NSString* available = [pasteboard availableTypeFromArray:types];
38 EXPECT_TRUE(available != nil);
39
40 // Ensure the path is what we expect.
41 NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType];
42 ASSERT_TRUE(files != nil);
43 NSString* expectedPath = [files objectAtIndex:0];
44 NSString* realPath = base::SysWideToNSString(testPath.ToWStringHack());
45 EXPECT_TRUE([expectedPath isEqualToString:realPath]);
46 }
47
48 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/download_util_mac.mm ('k') | chrome/browser/dom_ui/downloads_dom_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698