Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: chrome/browser/automation/automation_provider.cc

Issue 3030042: New translate tests for pyauto.py (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Adding corpora Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/translate/ar/google.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/automation_provider.cc
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index bfe879f4f06f9e303dc7e97bd8d8cc36926bf634..5652cb3cb482e344afad245d678eddc0fded328d 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -2875,26 +2875,28 @@ void AutomationProvider::WaitUntilTranslateComplete(
return;
}
- // If the translation is still pending, the observer will wait
- // for it to finish and then reply.
- if (tab_contents->language_state().translation_pending()) {
- new PageTranslatedObserver(this, reply_message, tab_contents);
- return;
- }
- // Otherwise send back the success or failure of the attempted translation
- // based on the translate bar state.
- AutomationJSONReply reply(this, reply_message);
TranslateInfoBarDelegate* translate_bar =
GetTranslateInfoBarDelegate(tab_contents);
scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+
if (!translate_bar) {
return_value->SetBoolean(L"translation_success", false);
- } else {
- return_value->SetBoolean(
- L"translation_success",
- translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE);
+ AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
+ return;
}
- reply.SendSuccess(return_value.get());
+
+ // If the translation is still pending, the observer will wait
+ // for it to finish and then reply.
+ if (translate_bar->type() == TranslateInfoBarDelegate::TRANSLATING) {
+ new PageTranslatedObserver(this, reply_message, tab_contents);
+ return;
+ }
+
+ // Otherwise send back the success or failure of the attempted translation.
+ return_value->SetBoolean(
+ L"translation_success",
+ translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE);
+ AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
}
// Sample json input: { "command": "GetThemeInfo" }
« no previous file with comments | « no previous file | chrome/test/data/translate/ar/google.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698