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

Side by Side Diff: Source/platform/TestingPlatformSupport.h

Issue 316343004: Add unittest for OpenTypeSanitizer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: PLATFORM_EXPORT for tests Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 14 matching lines...) Expand all
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 #ifndef TestingPlatformSupport_h 31 #ifndef TestingPlatformSupport_h
32 #define TestingPlatformSupport_h 32 #define TestingPlatformSupport_h
33 33
34 #include "public/platform/Platform.h" 34 #include "public/platform/Platform.h"
35 #include "public/platform/WebData.h"
35 #include "public/platform/WebDiscardableMemory.h" 36 #include "public/platform/WebDiscardableMemory.h"
37 #include "public/platform/WebString.h"
38 #include "public/platform/WebUnitTestSupport.h"
36 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
37 40
38 namespace WebCore { 41 namespace WebCore {
39 42
40 class TestingDiscardableMemory : public blink::WebDiscardableMemory { 43 class TestingDiscardableMemory : public blink::WebDiscardableMemory {
41 public: 44 public:
42 explicit TestingDiscardableMemory(size_t); 45 explicit TestingDiscardableMemory(size_t);
43 virtual ~TestingDiscardableMemory(); 46 virtual ~TestingDiscardableMemory();
44 47
45 // blink::WebDiscardableMemory: 48 // blink::WebDiscardableMemory:
46 virtual bool lock() OVERRIDE; 49 virtual bool lock() OVERRIDE;
47 virtual void* data() OVERRIDE; 50 virtual void* data() OVERRIDE;
48 virtual void unlock() OVERRIDE; 51 virtual void unlock() OVERRIDE;
49 52
50 private: 53 private:
51 Vector<char> m_data; 54 Vector<char> m_data;
52 bool m_isLocked; 55 bool m_isLocked;
53 }; 56 };
54 57
55 class TestingPlatformSupport : public blink::Platform { 58 class TestingPlatformSupport : public blink::Platform, public blink::WebUnitTest Support {
56 public: 59 public:
57 struct Config { 60 struct Config {
58 Config() : hasDiscardableMemorySupport(false) { } 61 Config() : hasDiscardableMemorySupport(false) { }
59 62
60 bool hasDiscardableMemorySupport; 63 bool hasDiscardableMemorySupport;
61 }; 64 };
62 65
63 explicit TestingPlatformSupport(const Config&); 66 explicit TestingPlatformSupport(const Config&);
64 67
65 virtual ~TestingPlatformSupport(); 68 virtual ~TestingPlatformSupport();
66 69
67 // blink::Platform: 70 // blink::Platform:
68 virtual blink::WebDiscardableMemory* allocateAndLockDiscardableMemory(size_t bytes) OVERRIDE; 71 virtual blink::WebDiscardableMemory* allocateAndLockDiscardableMemory(size_t bytes) OVERRIDE;
69 virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t len gth) OVERRIDE; 72 virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t len gth) OVERRIDE;
70 virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categor yName) OVERRIDE; 73 virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categor yName) OVERRIDE;
74 virtual WebUnitTestSupport* unitTestSupport() OVERRIDE;
75
76 // blink::WebUnitTestSupport:
77 virtual blink::WebString webKitRootDir() OVERRIDE;
78 virtual blink::WebData readFromFile(const blink::WebString& path) OVERRIDE;
71 79
72 private: 80 private:
73 const Config m_config; 81 const Config m_config;
74 blink::Platform* const m_oldPlatform; 82 blink::Platform* const m_oldPlatform;
75 }; 83 };
76 84
77 } // namespace WebCore 85 } // namespace WebCore
78 86
79 #endif // TestingPlatformSupport_h 87 #endif // TestingPlatformSupport_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/TestingPlatformSupport.cpp » ('j') | Source/platform/TestingPlatformSupport.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698