Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/support/test_webkit_platform_support.h" | 5 #include "webkit/support/test_webkit_platform_support.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 size_t length, | 542 size_t length, |
| 543 size_t before_index, | 543 size_t before_index, |
| 544 const WebKit::WebString& locale) { | 544 const WebKit::WebString& locale) { |
| 545 DCHECK(locale.isEmpty() || locale.equals("en") || locale.equals("en_US") || | 545 DCHECK(locale.isEmpty() || locale.equals("en") || locale.equals("en_US") || |
| 546 locale.equals("en_GB")); | 546 locale.equals("en_GB")); |
| 547 if (!hyphen_dictionary_) { | 547 if (!hyphen_dictionary_) { |
| 548 // Initialize the hyphen library with a sample dictionary. To avoid test | 548 // Initialize the hyphen library with a sample dictionary. To avoid test |
| 549 // flakiness, this code synchronously loads the dictionary. | 549 // flakiness, this code synchronously loads the dictionary. |
| 550 base::FilePath path = webkit_support::GetChromiumRootDirFilePath(); | 550 base::FilePath path = webkit_support::GetChromiumRootDirFilePath(); |
| 551 path = path.Append(FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic")); | 551 path = path.Append(FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic")); |
| 552 std::string dictionary; | 552 hyphen_dictionary_ = hnj_hyphen_load(path.value().c_str()); |
|
darin (slow to review)
2013/02/15 18:16:40
Does this work on Windows? FilePath::value() retu
Paweł Hajdan Jr.
2013/02/19 13:00:12
Fixed. Thank you for advice about Windows quirks.
| |
| 553 if (!file_util::ReadFileToString(path, &dictionary)) | |
| 554 return 0; | |
| 555 hyphen_dictionary_ = hnj_hyphen_load( | |
| 556 reinterpret_cast<const unsigned char*>(dictionary.data()), | |
| 557 dictionary.length()); | |
| 558 if (!hyphen_dictionary_) | 553 if (!hyphen_dictionary_) |
| 559 return 0; | 554 return 0; |
| 560 } | 555 } |
| 561 // Retrieve the positions where we can insert hyphens. This function assumes | 556 // Retrieve the positions where we can insert hyphens. This function assumes |
| 562 // the input word is an English word so it can use the position returned by | 557 // the input word is an English word so it can use the position returned by |
| 563 // the hyphen library without conversion. | 558 // the hyphen library without conversion. |
| 564 string16 word_utf16(characters, length); | 559 string16 word_utf16(characters, length); |
| 565 if (!IsStringASCII(word_utf16)) | 560 if (!IsStringASCII(word_utf16)) |
| 566 return 0; | 561 return 0; |
| 567 std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16)); | 562 std::string word = StringToLowerASCII(UTF16ToASCII(word_utf16)); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 // TODO(jamesr): Support TestViewTypeLayoutTest. | 651 // TODO(jamesr): Support TestViewTypeLayoutTest. |
| 657 DCHECK_EQ(TestViewTypeUnitTest, type); | 652 DCHECK_EQ(TestViewTypeUnitTest, type); |
| 658 scoped_ptr<WebKit::WebLayerTreeViewImplForTesting> view( | 653 scoped_ptr<WebKit::WebLayerTreeViewImplForTesting> view( |
| 659 new WebKit::WebLayerTreeViewImplForTesting); | 654 new WebKit::WebLayerTreeViewImplForTesting); |
| 660 if (!view->initialize()) | 655 if (!view->initialize()) |
| 661 return NULL; | 656 return NULL; |
| 662 return view.release(); | 657 return view.release(); |
| 663 } | 658 } |
| 664 #endif | 659 #endif |
| 665 | 660 |
| OLD | NEW |