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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/download_util_mac_unittest.mm
===================================================================
--- chrome/browser/cocoa/download_util_mac_unittest.mm (revision 0)
+++ chrome/browser/cocoa/download_util_mac_unittest.mm (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Download utility test for Mac OS X.
+
+#include "base/path_service.h"
+#include "base/sys_string_conversions.h"
+#import "chrome/browser/cocoa/cocoa_test_helper.h"
+#import "chrome/browser/cocoa/download_util_mac.h"
+#include "chrome/common/chrome_paths.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+class DownloadUtilTest : public testing::Test {
+ public:
+ CocoaTestHelper cocoa_helper_;
+};
+
+// Ensure adding files to the pasteboard methods works as expected.
+TEST_F(DownloadUtilTest, AddFileToPasteboardTest) {
+ // Create a pasteboard.
+ NSPasteboard* pasteboard = [NSPasteboard pasteboardWithUniqueName];
+
+ // Get a download test file for addition to the pasteboard.
+ FilePath testPath;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &testPath));
+ FilePath testFile(FILE_PATH_LITERAL("download-test1.lib"));
+ testPath = testPath.Append(testFile);
+
+ // Add a test file to the pasteboard via the download_util method.
+ download_util::AddFileToPasteboard(pasteboard, testPath);
+
+ // Test to see that the object type for dragging files is available.
+ NSArray* types = [NSArray arrayWithObject:NSFilenamesPboardType];
+ NSString* available = [pasteboard availableTypeFromArray:types];
+ EXPECT_TRUE(available != nil);
+
+ // Ensure the path is what we expect.
+ NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType];
+ ASSERT_TRUE(files != nil);
+ NSString* expectedPath = [files objectAtIndex:0];
+ NSString* realPath = base::SysWideToNSString(testPath.ToWStringHack());
+ EXPECT_TRUE([expectedPath isEqualToString:realPath]);
+}
+
+} // namespace
Property changes on: chrome/browser/cocoa/download_util_mac_unittest.mm
___________________________________________________________________
Name: svn:eol-style
+ LF
« 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