Index: chrome/renderer/translate/translate_helper_browsertest.cc |
diff --git a/chrome/renderer/translate/translate_helper_browsertest.cc b/chrome/renderer/translate/translate_helper_browsertest.cc |
index 679b62803a798fb432ee3297c481dec8d4eeb2ba..b0238cdbfd10693c5cd4ebcd1772ca577d77a820 100644 |
--- a/chrome/renderer/translate/translate_helper_browsertest.cc |
+++ b/chrome/renderer/translate/translate_helper_browsertest.cc |
@@ -112,12 +112,14 @@ class TestTranslateHelper : public translate::TranslateHelper { |
MOCK_METHOD0(HasTranslationFinished, bool()); |
MOCK_METHOD0(HasTranslationFailed, bool()); |
MOCK_METHOD0(GetOriginalPageLanguage, std::string()); |
+ MOCK_METHOD0(GetErrorCode, int64_t()); |
MOCK_METHOD0(StartTranslation, bool()); |
MOCK_METHOD1(ExecuteScript, void(const std::string&)); |
MOCK_METHOD2(ExecuteScriptAndGetBoolResult, bool(const std::string&, bool)); |
MOCK_METHOD1(ExecuteScriptAndGetStringResult, |
std::string(const std::string&)); |
MOCK_METHOD1(ExecuteScriptAndGetDoubleResult, double(const std::string&)); |
+ MOCK_METHOD1(ExecuteScriptAndGetIntegerResult, int64_t(const std::string&)); |
private: |
void OnPageTranslated(bool cancelled, |
@@ -184,12 +186,16 @@ TEST_F(TranslateHelperBrowserTest, TranslateLibNeverReady) { |
// translate_helper.cc |
.WillRepeatedly(Return(false)); |
+ EXPECT_CALL(*translate_helper_, GetErrorCode()) |
+ .Times(AtLeast(5)) |
+ .WillRepeatedly(Return(translate::TranslateErrors::NONE)); |
+ |
translate_helper_->TranslatePage("en", "fr", std::string()); |
base::RunLoop().RunUntilIdle(); |
translate::TranslateErrors::Type error; |
ASSERT_TRUE(translate_helper_->GetPageTranslatedResult(NULL, NULL, &error)); |
- EXPECT_EQ(translate::TranslateErrors::INITIALIZATION_ERROR, error); |
+ EXPECT_EQ(translate::TranslateErrors::TRANSLATION_TIMEOUT, error); |
} |
// Tests that the browser gets notified of the translation success when the |
@@ -205,6 +211,9 @@ TEST_F(TranslateHelperBrowserTest, TranslateSuccess) { |
.WillOnce(Return(false)) |
.WillOnce(Return(true)); |
+ EXPECT_CALL(*translate_helper_, GetErrorCode()) |
+ .WillOnce(Return(translate::TranslateErrors::NONE)); |
+ |
EXPECT_CALL(*translate_helper_, StartTranslation()).WillOnce(Return(true)); |
// Succeed after few checks. |
@@ -259,6 +268,9 @@ TEST_F(TranslateHelperBrowserTest, TranslateFailure) { |
.Times(AtLeast(1)) |
.WillRepeatedly(Return(false)); |
+ EXPECT_CALL(*translate_helper_, GetErrorCode()) |
+ .WillOnce(Return(translate::TranslateErrors::TRANSLATION_ERROR)); |
+ |
// V8 call for performance monitoring should be ignored. |
EXPECT_CALL(*translate_helper_, |
ExecuteScriptAndGetDoubleResult(_)).Times(2); |