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

Side by Side Diff: Source/web/tests/WebImageTest.cpp

Issue 19906002: Move data/ directory from WebKit/chromium/tests into web/tests/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 years, 5 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 11 matching lines...) Expand all
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32
33 #include "public/platform/WebImage.h" 32 #include "public/platform/WebImage.h"
34 33
35 #include <gtest/gtest.h> 34 #include <gtest/gtest.h>
36 #include "core/platform/FileSystem.h" 35 #include "core/platform/FileSystem.h"
37 #include "core/platform/SharedBuffer.h" 36 #include "core/platform/SharedBuffer.h"
38 #include "public/platform/Platform.h" 37 #include "public/platform/Platform.h"
39 #include "public/platform/WebData.h" 38 #include "public/platform/WebData.h"
40 #include "public/platform/WebSize.h" 39 #include "public/platform/WebSize.h"
41 #include "public/platform/WebUnitTestSupport.h" 40 #include "public/platform/WebUnitTestSupport.h"
42 41
43 using namespace WebCore; 42 using namespace WebCore;
44 using namespace WebKit; 43 using namespace WebKit;
45 44
46 namespace { 45 namespace {
47 46
48 static PassRefPtr<SharedBuffer> readFile(const char* fileName) 47 static PassRefPtr<SharedBuffer> readFile(const char* fileName)
49 { 48 {
50 String filePath = Platform::current()->unitTestSupport()->webKitRootDir(); 49 String filePath = Platform::current()->unitTestSupport()->webKitRootDir();
51 filePath.append("/Source/WebKit/chromium/tests/data/"); 50 filePath.append("/Source/web/tests/data/");
52 filePath.append(fileName); 51 filePath.append(fileName);
53 52
54 long long fileSize; 53 long long fileSize;
55 if (!getFileSize(filePath, fileSize)) 54 if (!getFileSize(filePath, fileSize))
56 return 0; 55 return 0;
57 56
58 PlatformFileHandle handle = openFile(filePath, OpenForRead); 57 PlatformFileHandle handle = openFile(filePath, OpenForRead);
59 int fileLength = static_cast<int>(fileSize); 58 int fileLength = static_cast<int>(fileSize);
60 Vector<char> buffer(fileLength); 59 Vector<char> buffer(fileLength);
61 readFromFile(handle, buffer.data(), fileLength); 60 readFromFile(handle, buffer.data(), fileLength);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const char badImage[] = "hello world"; 102 const char badImage[] = "hello world";
104 WebVector<WebImage> images = WebImage::framesFromData(WebData(badImage)); 103 WebVector<WebImage> images = WebImage::framesFromData(WebData(badImage));
105 ASSERT_EQ(0u, images.size()); 104 ASSERT_EQ(0u, images.size());
106 105
107 WebImage image = WebImage::fromData(WebData(badImage), WebSize()); 106 WebImage image = WebImage::fromData(WebData(badImage), WebSize());
108 EXPECT_TRUE(image.getSkBitmap().empty()); 107 EXPECT_TRUE(image.getSkBitmap().empty());
109 EXPECT_TRUE(image.getSkBitmap().isNull()); 108 EXPECT_TRUE(image.getSkBitmap().isNull());
110 } 109 }
111 110
112 } // namespace 111 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/WebFrameTest.cpp ('k') | Source/web/tests/data/autofocus_input_field_iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698