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/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 }; | 88 }; |
89 | 89 |
90 // A fake completion object for verification. | 90 // A fake completion object for verification. |
91 class MockTextCheckingCompletion : public WebKit::WebTextCheckingCompletion { | 91 class MockTextCheckingCompletion : public WebKit::WebTextCheckingCompletion { |
92 public: | 92 public: |
93 MockTextCheckingCompletion() | 93 MockTextCheckingCompletion() |
94 : completion_count_(0) { | 94 : completion_count_(0) { |
95 } | 95 } |
96 | 96 |
97 virtual void didFinishCheckingText( | 97 virtual void didFinishCheckingText( |
98 const WebKit::WebVector<WebKit::WebTextCheckingResult>& results) { | 98 const WebKit::WebVector<WebKit::WebTextCheckingResult>& results) |
| 99 OVERRIDE { |
99 completion_count_++; | 100 completion_count_++; |
100 last_results_ = results; | 101 last_results_ = results; |
101 } | 102 } |
102 | 103 |
| 104 virtual void didCancelCheckingText() OVERRIDE { |
| 105 completion_count_++; |
| 106 } |
| 107 |
103 size_t completion_count_; | 108 size_t completion_count_; |
104 WebKit::WebVector<WebKit::WebTextCheckingResult> last_results_; | 109 WebKit::WebVector<WebKit::WebTextCheckingResult> last_results_; |
105 }; | 110 }; |
106 | 111 |
107 // Operates unit tests for the webkit_glue::SpellCheckWord() function | 112 // Operates unit tests for the webkit_glue::SpellCheckWord() function |
108 // with the US English dictionary. | 113 // with the US English dictionary. |
109 // The unit tests in this function consist of: | 114 // The unit tests in this function consist of: |
110 // * Tests for the function with empty strings; | 115 // * Tests for the function with empty strings; |
111 // * Tests for the function with a valid English word; | 116 // * Tests for the function with a valid English word; |
112 // * Tests for the function with a valid non-English word; | 117 // * Tests for the function with a valid non-English word; |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 InitializeSpellCheck("en-US"); | 965 InitializeSpellCheck("en-US"); |
961 | 966 |
962 // Calls PostDelayedSpellCheckTask instead of OnInit here for simplicity. | 967 // Calls PostDelayedSpellCheckTask instead of OnInit here for simplicity. |
963 spell_check()->PostDelayedSpellCheckTask(); | 968 spell_check()->PostDelayedSpellCheckTask(); |
964 MessageLoop::current()->RunAllPending(); | 969 MessageLoop::current()->RunAllPending(); |
965 for (int i = 0; i < 3; ++i) | 970 for (int i = 0; i < 3; ++i) |
966 EXPECT_EQ(completion[i].completion_count_, 1U); | 971 EXPECT_EQ(completion[i].completion_count_, 1U); |
967 } | 972 } |
968 | 973 |
969 #endif | 974 #endif |
OLD | NEW |