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

Issue 2919343007: Check |errorCode| of translate.js and notify to Browser (Closed)

Created:
3 years, 6 months ago by Gaja
Modified:
3 years, 5 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam, mlamouri+watch-content_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Check |errorCode| of translate.js and notify to Browser CheckTranslateStatus() always returns TranslateErrors::TRANSLATION_ERROR when there is an error during translation. Instead, get the error code from translate.js and convert to TranslateErrors::Type to notify actual error type. BUG=301568 Review-Url: https://codereview.chromium.org/2919343007 Cr-Commit-Position: refs/heads/master@{#484223} Committed: https://chromium.googlesource.com/chromium/src/+/5bcb90a3e2cf481e8fcfca0b5573effab5479a49

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Total comments: 2

Patch Set 4 : Addressing review comments : Use static_cast for enum conversion instead of switch case. #

Total comments: 2

Patch Set 5 : Added test cases to check for translate error types and a minor refactoring. #

Total comments: 25

Patch Set 6 : Addressed review comments (2 comments yet to be addressed). Test case code simplification. #

Patch Set 7 : Addressed review comments. #

Total comments: 7

Patch Set 8 : Addressed review comments. #

Patch Set 9 : Update comment in translate_errors.h #

Total comments: 1

Patch Set 10 : Mock ExecuteScriptAndGetIntegerResult function #

Patch Set 11 : Addressed review comment #

Patch Set 12 : Removed fallback argument of ExecuteScriptAndGetIntegerResult function #

Patch Set 13 : nit #

Patch Set 14 : Rebase #

Total comments: 3

Patch Set 15 : Probably fixes mac failures. This patch is to check dryrun. If passes, will request for review. #

Total comments: 2

Patch Set 16 : Addressed review comment. Proper order of enum variables in switch case. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+512 lines, -65 lines) Patch
M chrome/browser/translate/translate_manager_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 13 chunks +449 lines, -59 lines 0 comments Download
M chrome/renderer/translate/translate_helper_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +13 lines, -1 line 0 comments Download
M components/translate/content/renderer/translate_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +8 lines, -0 lines 0 comments Download
M components/translate/content/renderer/translate_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +37 lines, -4 lines 0 comments Download
M components/translate/core/browser/translate_infobar_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -0 lines 0 comments Download
M components/translate/core/common/translate_errors.h View 1 2 3 4 5 6 8 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 73 (22 generated)
Gaja
Please take a look.
3 years, 6 months ago (2017-06-08 12:42:54 UTC) #3
Takashi Toyoshima
Sorry, I overlooked this review request. main change looks good, but there is a minor ...
3 years, 6 months ago (2017-06-13 11:58:29 UTC) #4
Gaja
On 2017/06/13 11:58:29, Takashi Toyoshima wrote: > Sorry, I overlooked this review request. That's OK ...
3 years, 6 months ago (2017-06-14 03:11:36 UTC) #5
Gaja
https://codereview.chromium.org/2919343007/diff/40001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/40001/components/translate/content/renderer/translate_helper.cc#newcode67 components/translate/content/renderer/translate_helper.cc:67: static TranslateErrors::Type ErrorCodeToTranslateErrorType(int64_t error_code) { On 2017/06/13 11:58:29, Takashi ...
3 years, 6 months ago (2017-06-14 03:11:45 UTC) #6
Takashi Toyoshima
You would find related crbugs that would be written in BUG= line. For instance, 301570 ...
3 years, 6 months ago (2017-06-14 03:59:45 UTC) #7
Takashi Toyoshima
Also one more comment https://codereview.chromium.org/2919343007/diff/60001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/60001/components/translate/content/renderer/translate_helper.cc#newcode357 components/translate/content/renderer/translate_helper.cc:357: NotifyBrowserTranslationFailed(ErrorCodeToTranslateErrorType(error_code)); Probably it's consistent to ...
3 years, 6 months ago (2017-06-14 04:00:02 UTC) #8
Takashi Toyoshima
By the way do you think we could have a test to check if this ...
3 years, 6 months ago (2017-06-14 04:06:43 UTC) #9
Gaja
On 2017/06/14 03:59:45, Takashi Toyoshima wrote: > You would find related crbugs that would be ...
3 years, 6 months ago (2017-06-14 06:52:01 UTC) #10
Gaja
https://codereview.chromium.org/2919343007/diff/60001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/60001/components/translate/content/renderer/translate_helper.cc#newcode357 components/translate/content/renderer/translate_helper.cc:357: NotifyBrowserTranslationFailed(ErrorCodeToTranslateErrorType(error_code)); On 2017/06/14 04:00:02, Takashi Toyoshima wrote: > Probably ...
3 years, 6 months ago (2017-06-14 06:53:12 UTC) #11
Gaja
@Takashi Toyoshima I have added test cases that checks for TranslateErrors::Type enum values. Please take ...
3 years, 6 months ago (2017-06-16 04:15:54 UTC) #13
Takashi Toyoshima
https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.cc#newcode372 components/translate/content/renderer/translate_helper.cc:372: if (actual_source_lang == target_lang_) { What is the motivation ...
3 years, 6 months ago (2017-06-16 04:51:29 UTC) #15
Takashi Toyoshima
https://docs.google.com/document/d/1W8tlFxoMTkspgYyCN0WQyzUkId0v8hbzEkvW08_r3_w/edit?usp=sharing FYI, this document explains how translate.js works with v8 and server provided library.
3 years, 6 months ago (2017-06-16 05:09:30 UTC) #16
napper
https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc File chrome/browser/translate/translate_manager_browsertest.cc (right): https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc#newcode27 chrome/browser/translate/translate_manager_browsertest.cc:27: " var google = {};" indent looks wrong https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc#newcode27 ...
3 years, 6 months ago (2017-06-16 12:41:52 UTC) #17
Takashi Toyoshima
https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.cc#newcode354 components/translate/content/renderer/translate_helper.cc:354: static_cast<translate::TranslateErrors::Type>(GetErrorCode())); maybe DCHECK inside GetErrorCode impl? https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.h File components/translate/content/renderer/translate_helper.h ...
3 years, 6 months ago (2017-06-16 16:14:17 UTC) #18
Gaja
https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc File chrome/browser/translate/translate_manager_browsertest.cc (right): https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc#newcode27 chrome/browser/translate/translate_manager_browsertest.cc:27: " var google = {};" On 2017/06/16 12:41:51, napper ...
3 years, 6 months ago (2017-06-17 06:41:46 UTC) #19
Gaja
https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc File chrome/browser/translate/translate_manager_browsertest.cc (right): https://codereview.chromium.org/2919343007/diff/80001/chrome/browser/translate/translate_manager_browsertest.cc#newcode27 chrome/browser/translate/translate_manager_browsertest.cc:27: " var google = {};" On 2017/06/16 12:41:51, napper ...
3 years, 6 months ago (2017-06-17 13:25:48 UTC) #20
napper
lgtm
3 years, 6 months ago (2017-06-18 21:43:26 UTC) #21
Takashi Toyoshima
looks good with one minor request. https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/80001/components/translate/content/renderer/translate_helper.cc#newcode372 components/translate/content/renderer/translate_helper.cc:372: if (actual_source_lang == ...
3 years, 6 months ago (2017-06-20 11:49:54 UTC) #22
Gaja
@Takashi Toyoshima I have addressed your comments. Please take a look at new patch set. ...
3 years, 6 months ago (2017-06-22 05:22:23 UTC) #23
Takashi Toyoshima
I'm running out of time today, will take a look tomorrow.
3 years, 6 months ago (2017-06-22 14:37:38 UTC) #24
Gaja
Dear Takashi Toyoshima, Please take a look at latest patch set. Thanks.
3 years, 5 months ago (2017-06-27 03:01:51 UTC) #25
Takashi Toyoshima
https://codereview.chromium.org/2919343007/diff/120001/chrome/browser/translate/translate_manager_browsertest.cc File chrome/browser/translate/translate_manager_browsertest.cc (right): https://codereview.chromium.org/2919343007/diff/120001/chrome/browser/translate/translate_manager_browsertest.cc#newcode329 chrome/browser/translate/translate_manager_browsertest.cc:329: EXPECT_EQ(translate::TranslateErrors::NONE, GetPageTranslatedResult()); This check fails because error_type_ wasn't initialized ...
3 years, 5 months ago (2017-06-27 12:04:55 UTC) #26
Gaja
@Takashi Toyoshima, Please check my replies to your comments and let me know your opinions ...
3 years, 5 months ago (2017-06-28 03:43:31 UTC) #27
Gaja
https://codereview.chromium.org/2919343007/diff/120001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/120001/components/translate/content/renderer/translate_helper.cc#newcode275 components/translate/content/renderer/translate_helper.cc:275: NOTREACHED(); Sorry, I made a mistake here. > With ...
3 years, 5 months ago (2017-06-28 04:16:01 UTC) #28
Takashi Toyoshima
https://codereview.chromium.org/2919343007/diff/120001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/120001/components/translate/content/renderer/translate_helper.cc#newcode275 components/translate/content/renderer/translate_helper.cc:275: NOTREACHED(); So, we should still have this NOTREACHED() check ...
3 years, 5 months ago (2017-06-28 07:25:32 UTC) #29
Gaja
@Takashi Toyoshima, Thanks for your comments and guidance. Please take a look at latest patch ...
3 years, 5 months ago (2017-06-28 11:34:45 UTC) #30
Takashi Toyoshima
Ah, that's right. Since almost all methods to touch v8 are mocked in that test, ...
3 years, 5 months ago (2017-06-29 11:48:42 UTC) #31
Gaja
On 2017/06/29 11:48:42, Takashi Toyoshima wrote: > Ah, that's right. > Since almost all methods ...
3 years, 5 months ago (2017-06-29 11:58:13 UTC) #32
Takashi Toyoshima
Probably this will be the last comment. Others look fine. I confirmed that if error_type_ ...
3 years, 5 months ago (2017-06-29 11:59:15 UTC) #33
Gaja
> why don't you use translate::TranslationErrors::TRANSLATION_ERROR? > > Ditto for other returning 0 cases. Done. ...
3 years, 5 months ago (2017-06-29 12:10:08 UTC) #34
Takashi Toyoshima
yeah, could you?
3 years, 5 months ago (2017-06-29 12:39:37 UTC) #35
Gaja
On 2017/06/29 12:39:37, Takashi Toyoshima wrote: > yeah, could you? Done.
3 years, 5 months ago (2017-06-29 13:02:25 UTC) #36
Gaja
On 2017/06/29 13:02:25, Gaja wrote: > On 2017/06/29 12:39:37, Takashi Toyoshima wrote: > > yeah, ...
3 years, 5 months ago (2017-07-01 06:54:43 UTC) #37
Takashi Toyoshima
one minor request against newly added code. https://codereview.chromium.org/2919343007/diff/260001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/260001/components/translate/content/renderer/translate_helper.cc#newcode468 components/translate/content/renderer/translate_helper.cc:468: base::GetQuotedJSONString(source_lang) + ...
3 years, 5 months ago (2017-07-03 12:12:52 UTC) #38
Takashi Toyoshima
Also let me kick tryrun for the final check.
3 years, 5 months ago (2017-07-03 12:13:37 UTC) #41
Gaja
https://codereview.chromium.org/2919343007/diff/260001/components/translate/content/renderer/translate_helper.cc File components/translate/content/renderer/translate_helper.cc (right): https://codereview.chromium.org/2919343007/diff/260001/components/translate/content/renderer/translate_helper.cc#newcode468 components/translate/content/renderer/translate_helper.cc:468: base::GetQuotedJSONString(source_lang) + "," + On 2017/07/03 12:12:52, Takashi Toyoshima ...
3 years, 5 months ago (2017-07-03 12:58:50 UTC) #42
Takashi Toyoshima
LGTM. But failed tests may be related to this CL (translation related browser tests failing ...
3 years, 5 months ago (2017-07-03 13:28:58 UTC) #45
Gaja
On 2017/07/03 13:28:58, Takashi Toyoshima wrote: > LGTM. > > But failed tests may be ...
3 years, 5 months ago (2017-07-03 15:29:00 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2919343007/260001
3 years, 5 months ago (2017-07-03 15:29:34 UTC) #49
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/491209)
3 years, 5 months ago (2017-07-03 16:34:13 UTC) #51
Gaja
I went through the logs and noticed that : 1) Test case : TranslateManagerBrowserTest.PageTranslationIdenticalLanguagesError is ...
3 years, 5 months ago (2017-07-03 17:05:04 UTC) #52
Gaja
Dear Takashi Toyoshima, I have uploaded changes to fix failures on mac. Please review the ...
3 years, 5 months ago (2017-07-04 04:10:15 UTC) #57
Gaja
With PS15, CQ dry run passed all tryjobs including mac.
3 years, 5 months ago (2017-07-04 04:26:07 UTC) #58
Takashi Toyoshima
https://codereview.chromium.org/2919343007/diff/280001/components/translate/core/browser/translate_infobar_delegate.cc File components/translate/core/browser/translate_infobar_delegate.cc (right): https://codereview.chromium.org/2919343007/diff/280001/components/translate/core/browser/translate_infobar_delegate.cc#newcode228 components/translate/core/browser/translate_infobar_delegate.cc:228: IDS_TRANSLATE_INFOBAR_ERROR_CANT_CONNECT); coding style nits: Basically the "case" is placed ...
3 years, 5 months ago (2017-07-05 05:37:18 UTC) #59
Gaja
Please take a look. https://codereview.chromium.org/2919343007/diff/280001/components/translate/core/browser/translate_infobar_delegate.cc File components/translate/core/browser/translate_infobar_delegate.cc (right): https://codereview.chromium.org/2919343007/diff/280001/components/translate/core/browser/translate_infobar_delegate.cc#newcode228 components/translate/core/browser/translate_infobar_delegate.cc:228: IDS_TRANSLATE_INFOBAR_ERROR_CANT_CONNECT); On 2017/07/05 05:37:17, Takashi ...
3 years, 5 months ago (2017-07-05 05:48:42 UTC) #60
Takashi Toyoshima
thank you for continuous efforts to make this finished. LGTM again!
3 years, 5 months ago (2017-07-05 06:52:35 UTC) #61
Gaja
On 2017/07/05 06:52:35, Takashi Toyoshima wrote: > thank you for continuous efforts to make this ...
3 years, 5 months ago (2017-07-05 07:10:32 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2919343007/300001
3 years, 5 months ago (2017-07-05 07:10:53 UTC) #65
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/481837)
3 years, 5 months ago (2017-07-05 07:53:36 UTC) #67
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2919343007/300001
3 years, 5 months ago (2017-07-05 08:07:27 UTC) #69
commit-bot: I haz the power
3 years, 5 months ago (2017-07-05 09:03:31 UTC) #73
Message was sent while issue was closed.
Committed patchset #16 (id:300001) as
https://chromium.googlesource.com/chromium/src/+/5bcb90a3e2cf481e8fcfca0b5573...

Powered by Google App Engine
This is Rietveld 408576698