| Index: content/browser/speech/speech_recognition_request_unittest.cc
|
| diff --git a/content/browser/speech/speech_recognition_request_unittest.cc b/content/browser/speech/speech_recognition_request_unittest.cc
|
| index 92210859f708958ff353df7e70eba3eddc24f9b2..37b82f8878c96059d750188250eea920f69f1a8d 100644
|
| --- a/content/browser/speech/speech_recognition_request_unittest.cc
|
| +++ b/content/browser/speech/speech_recognition_request_unittest.cc
|
| @@ -1,17 +1,17 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| #include "base/message_loop.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "content/browser/speech/speech_recognition_request.h"
|
| -#include "content/public/common/speech_input_result.h"
|
| +#include "content/public/common/speech_recognition_result.h"
|
| #include "content/test/test_url_fetcher_factory.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
| #include "net/url_request/url_request_status.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -namespace speech_input {
|
| +namespace speech {
|
|
|
| class SpeechRecognitionRequestTest : public SpeechRecognitionRequestDelegate,
|
| public testing::Test {
|
| @@ -24,14 +24,14 @@ class SpeechRecognitionRequestTest : public SpeechRecognitionRequestDelegate,
|
|
|
| // SpeechRecognitionRequestDelegate methods.
|
| virtual void SetRecognitionResult(
|
| - const content::SpeechInputResult& result) OVERRIDE {
|
| + const content::SpeechRecognitionResult& result) OVERRIDE {
|
| result_ = result;
|
| }
|
|
|
| protected:
|
| MessageLoop message_loop_;
|
| TestURLFetcherFactory url_fetcher_factory_;
|
| - content::SpeechInputResult result_;
|
| + content::SpeechRecognitionResult result_;
|
| };
|
|
|
| void SpeechRecognitionRequestTest::CreateAndTestRequest(
|
| @@ -60,7 +60,7 @@ TEST_F(SpeechRecognitionRequestTest, BasicTest) {
|
| CreateAndTestRequest(true,
|
| "{\"status\":0,\"hypotheses\":"
|
| "[{\"utterance\":\"123456\",\"confidence\":0.9}]}");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NONE);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NONE);
|
| EXPECT_EQ(1U, result_.hypotheses.size());
|
| EXPECT_EQ(ASCIIToUTF16("123456"), result_.hypotheses[0].utterance);
|
| EXPECT_EQ(0.9, result_.hypotheses[0].confidence);
|
| @@ -70,7 +70,7 @@ TEST_F(SpeechRecognitionRequestTest, BasicTest) {
|
| "{\"status\":0,\"hypotheses\":["
|
| "{\"utterance\":\"hello\",\"confidence\":0.9},"
|
| "{\"utterance\":\"123456\",\"confidence\":0.5}]}");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NONE);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NONE);
|
| EXPECT_EQ(2u, result_.hypotheses.size());
|
| EXPECT_EQ(ASCIIToUTF16("hello"), result_.hypotheses[0].utterance);
|
| EXPECT_EQ(0.9, result_.hypotheses[0].confidence);
|
| @@ -79,29 +79,29 @@ TEST_F(SpeechRecognitionRequestTest, BasicTest) {
|
|
|
| // Zero results.
|
| CreateAndTestRequest(true, "{\"status\":0,\"hypotheses\":[]}");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NONE);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NONE);
|
| EXPECT_EQ(0U, result_.hypotheses.size());
|
|
|
| // Http failure case.
|
| CreateAndTestRequest(false, "");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NETWORK);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NETWORK);
|
| EXPECT_EQ(0U, result_.hypotheses.size());
|
|
|
| // Invalid status case.
|
| CreateAndTestRequest(true, "{\"status\":\"invalid\",\"hypotheses\":[]}");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NETWORK);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NETWORK);
|
| EXPECT_EQ(0U, result_.hypotheses.size());
|
|
|
| // Server-side error case.
|
| CreateAndTestRequest(true, "{\"status\":1,\"hypotheses\":[]}");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NETWORK);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NETWORK);
|
| EXPECT_EQ(0U, result_.hypotheses.size());
|
|
|
| // Malformed JSON case.
|
| CreateAndTestRequest(true, "{\"status\":0,\"hypotheses\":"
|
| "[{\"unknownkey\":\"hello\"}]}");
|
| - EXPECT_EQ(result_.error, content::SPEECH_INPUT_ERROR_NETWORK);
|
| + EXPECT_EQ(result_.error, content::SPEECH_RECOGNITION_ERROR_NETWORK);
|
| EXPECT_EQ(0U, result_.hypotheses.size());
|
| }
|
|
|
| -} // namespace speech_input
|
| +} // namespace speech
|
|
|