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

Side by Side Diff: Source/core/clipboard/DataObjectTest.cpp

Issue 640303002: Enable Oilpan for core/clipboard/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove some slightly pointy edges Created 5 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
« no previous file with comments | « Source/core/clipboard/DataObjectItem.cpp ('k') | Source/core/clipboard/DataTransfer.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/clipboard/DataObject.h" 6 #include "core/clipboard/DataObject.h"
7 7
8 #include "core/clipboard/DataObjectItem.h" 8 #include "core/clipboard/DataObjectItem.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "public/platform/WebUnitTestSupport.h" 10 #include "public/platform/WebUnitTestSupport.h"
11 #include <gtest/gtest.h> 11 #include <gtest/gtest.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class DataObjectTest : public ::testing::Test { 15 class DataObjectTest : public ::testing::Test {
16 public: 16 public:
17 DataObjectTest() 17 DataObjectTest()
18 : m_dataObject(DataObject::create()) 18 : m_dataObject(DataObject::create())
19 { 19 {
20 } 20 }
21 21
22 protected: 22 protected:
23 RefPtrWillBePersistent<DataObject> m_dataObject; 23 Persistent<DataObject> m_dataObject;
24 }; 24 };
25 25
26 TEST_F(DataObjectTest, addItemWithFilenameAndNoTitle) 26 TEST_F(DataObjectTest, addItemWithFilenameAndNoTitle)
27 { 27 {
28 String filePath = Platform::current()->unitTestSupport()->webKitRootDir(); 28 String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
29 filePath.append("/Source/core/clipboard/DataObjectTest.cpp"); 29 filePath.append("/Source/core/clipboard/DataObjectTest.cpp");
30 30
31 m_dataObject->addFilename(filePath, String()); 31 m_dataObject->addFilename(filePath, String());
32 EXPECT_EQ(1U, m_dataObject->length()); 32 EXPECT_EQ(1U, m_dataObject->length());
33 33
34 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->item(0); 34 DataObjectItem* item = m_dataObject->item(0);
35 EXPECT_EQ(DataObjectItem::FileKind, item->kind()); 35 EXPECT_EQ(DataObjectItem::FileKind, item->kind());
36 36
37 Blob* blob = item->getAsFile(); 37 Blob* blob = item->getAsFile();
38 ASSERT_TRUE(blob->isFile()); 38 ASSERT_TRUE(blob->isFile());
39 File* file = toFile(blob); 39 File* file = toFile(blob);
40 EXPECT_TRUE(file->hasBackingFile()); 40 EXPECT_TRUE(file->hasBackingFile());
41 EXPECT_EQ(File::IsUserVisible, file->userVisibility()); 41 EXPECT_EQ(File::IsUserVisible, file->userVisibility());
42 EXPECT_EQ(filePath, file->path()); 42 EXPECT_EQ(filePath, file->path());
43 } 43 }
44 44
45 TEST_F(DataObjectTest, addItemWithFilenameAndTitle) 45 TEST_F(DataObjectTest, addItemWithFilenameAndTitle)
46 { 46 {
47 String filePath = Platform::current()->unitTestSupport()->webKitRootDir(); 47 String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
48 filePath.append("/Source/core/clipboard/DataObjectTest.cpp"); 48 filePath.append("/Source/core/clipboard/DataObjectTest.cpp");
49 49
50 m_dataObject->addFilename(filePath, "name.cpp"); 50 m_dataObject->addFilename(filePath, "name.cpp");
51 EXPECT_EQ(1U, m_dataObject->length()); 51 EXPECT_EQ(1U, m_dataObject->length());
52 52
53 RefPtrWillBeRawPtr<DataObjectItem> item = m_dataObject->item(0); 53 DataObjectItem* item = m_dataObject->item(0);
54 EXPECT_EQ(DataObjectItem::FileKind, item->kind()); 54 EXPECT_EQ(DataObjectItem::FileKind, item->kind());
55 55
56 Blob* blob = item->getAsFile(); 56 Blob* blob = item->getAsFile();
57 ASSERT_TRUE(blob->isFile()); 57 ASSERT_TRUE(blob->isFile());
58 File* file = toFile(blob); 58 File* file = toFile(blob);
59 EXPECT_TRUE(file->hasBackingFile()); 59 EXPECT_TRUE(file->hasBackingFile());
60 EXPECT_EQ(File::IsUserVisible, file->userVisibility()); 60 EXPECT_EQ(File::IsUserVisible, file->userVisibility());
61 EXPECT_EQ(filePath, file->path()); 61 EXPECT_EQ(filePath, file->path());
62 EXPECT_EQ("name.cpp", file->name()); 62 EXPECT_EQ("name.cpp", file->name());
63 } 63 }
64 64
65 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/clipboard/DataObjectItem.cpp ('k') | Source/core/clipboard/DataTransfer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698