OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 #ifndef WEBKIT_MOCKS_MOCK_WEBHYPHENATOR_H_ |
| 6 #define WEBKIT_MOCKS_MOCK_WEBHYPHENATOR_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/platform_file.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebHyphenator.h" |
| 12 |
| 13 typedef struct _HyphenDict HyphenDict; |
| 14 |
| 15 namespace webkit_glue { |
| 16 |
| 17 // Implements a simple WebHyphenator that only supports en-US. It is used for |
| 18 // layout tests that expect that hyphenator to be available synchronously. |
| 19 // Therefore, this class supports synchronous loading of the dictionary as well. |
| 20 class MockWebHyphenator : public WebKit::WebHyphenator { |
| 21 public: |
| 22 MockWebHyphenator(); |
| 23 virtual ~MockWebHyphenator(); |
| 24 |
| 25 // Loads the hyphenation dictionary. |dict_file| should be an open fd to |
| 26 // third_party/hyphen/hyph_en_US.dic. |
| 27 void LoadDictionary(base::PlatformFile dict_file); |
| 28 |
| 29 // WebHyphenator implementation. |
| 30 virtual bool canHyphenate(const WebKit::WebString& locale) OVERRIDE; |
| 31 virtual size_t computeLastHyphenLocation( |
| 32 const char16* characters, |
| 33 size_t length, |
| 34 size_t before_index, |
| 35 const WebKit::WebString& locale) OVERRIDE; |
| 36 |
| 37 private: |
| 38 HyphenDict* hyphen_dictionary_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(MockWebHyphenator); |
| 41 }; |
| 42 |
| 43 } // namespace webkit_glue |
| 44 |
| 45 #endif // WEBKIT_MOCKS_MOCK_WEBHYPHENATOR_H_ |
OLD | NEW |