Notify the text-check result
This change adds a 'success' parameter to SpellingServiceClient::TextCheckCompleteCallback so the SpellingServiceClient class can tell it finishes checking the input text successfully. This change also adds a new unit test for the SpellingServiceClient class to verify the class creates a JSON-RPC request to the Spelling service and handles a response from it.
BUG=none
TEST=SpellingServiceClientTest.RequestTextCheck
Review URL: http://codereview.chromium.org/10214015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134867 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/spellchecker/spelling_service_client.h b/chrome/browser/spellchecker/spelling_service_client.h
index 3a80fc8e..279ae98 100644
--- a/chrome/browser/spellchecker/spelling_service_client.h
+++ b/chrome/browser/spellchecker/spelling_service_client.h
@@ -15,6 +15,7 @@
#include "base/string16.h"
#include "content/public/common/url_fetcher_delegate.h"
+class GURL;
class Profile;
class TextCheckClientDelegate;
struct SpellCheckResult;
@@ -34,6 +35,7 @@
//
// void OnTextCheckComplete(
// int tag,
+// bool success,
// const std::vector<SpellCheckResult>& results) {
// ...
// }
@@ -62,6 +64,7 @@
};
typedef base::Callback<void(
int /* tag */,
+ bool /* success */,
const std::vector<SpellCheckResult>& /* results */)>
TextCheckCompleteCallback;
@@ -82,6 +85,11 @@
const TextCheckCompleteCallback& callback);
private:
+ // Creates a URLFetcher object used for sending a JSON-RPC request. This
+ // function is overriden by unit tests to prevent them from actually sending
+ // requests to the Spelling service.
+ virtual content::URLFetcher* CreateURLFetcher(const GURL& url);
+
// Parses a JSON-RPC response from the Spelling service.
bool ParseResponse(const std::string& data,
std::vector<SpellCheckResult>* results);