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

Issue 158003003: Convert Google Now's State Change Gathering Mechanism to use Promises (Closed)

Created:
6 years, 10 months ago by robliao
Modified:
6 years, 10 months ago
Reviewers:
vadimt, rgustafson, skare_
CC:
chromium-reviews, arv+watch_chromium.org
Visibility:
Public.

Description

Convert Google Now's State Change Gathering Mechanism to use Promises Now that Promises have arrived in stable, we can start using them. This change converts onStateChange to use promises and adds rudimentary unit test support to handle this new feature. V8's Promises are not used because the Javascript test harness expects tests to complete synchronously. Promises, which run asynchronously, may still be pending at the completion of a test, causing the test case to fail. BUG=164227 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=250992

Patch Set 1 #

Patch Set 2 : Fix Typo #

Total comments: 5

Patch Set 3 : CR Feedback #

Patch Set 4 : Fix Presubmit #

Total comments: 10

Patch Set 5 : Fix Comment #

Patch Set 6 : Update Terminology #

Patch Set 7 : Missed a spot #

Total comments: 2

Patch Set 8 : Change from .apply to .call #

Unified diffs Side-by-side diffs Delta from patch set Stats (+126 lines, -27 lines) Patch
M chrome/browser/resources/google_now/background.js View 1 2 3 4 5 1 chunk +73 lines, -27 lines 0 comments Download
M chrome/browser/resources/google_now/common_test_util.js View 1 2 3 4 5 6 7 1 chunk +42 lines, -0 lines 0 comments Download
M chrome/browser/resources/google_now/utility.js View 1 2 3 4 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (0 generated)
robliao
6 years, 10 months ago (2014-02-08 01:19:33 UTC) #1
vadimt
I suggest this order: first, share@ and rgustafson@ review this. I provide OWNERs review at ...
6 years, 10 months ago (2014-02-08 01:22:29 UTC) #2
robliao
Sounds good.
6 years, 10 months ago (2014-02-08 01:26:49 UTC) #3
robliao
Removing vadimt for now. Review away!
6 years, 10 months ago (2014-02-10 23:41:35 UTC) #4
rgustafson
https://codereview.chromium.org/158003003/diff/50001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/158003003/diff/50001/chrome/browser/resources/google_now/background.js#newcode1107 chrome/browser/resources/google_now/background.js:1107: return new Promise(function(onSuccess) { Just out of curiosity, is ...
6 years, 10 months ago (2014-02-11 03:18:59 UTC) #5
robliao
https://codereview.chromium.org/158003003/diff/50001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/158003003/diff/50001/chrome/browser/resources/google_now/background.js#newcode1107 chrome/browser/resources/google_now/background.js:1107: return new Promise(function(onSuccess) { On 2014/02/11 03:18:59, rgustafson wrote: ...
6 years, 10 months ago (2014-02-11 17:55:40 UTC) #6
skare_
https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js#newcode1091 chrome/browser/resources/google_now/background.js:1091: isSignedIn(), consider .all([ new Promise(isSignedIn), new Promise(isGeolocationEnabled), ...]); where ...
6 years, 10 months ago (2014-02-11 20:07:43 UTC) #7
robliao
https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js#newcode1091 chrome/browser/resources/google_now/background.js:1091: isSignedIn(), An async operation hands out promises to encapsulate ...
6 years, 10 months ago (2014-02-11 21:53:21 UTC) #8
robliao
Did a bit more digging on the terminology. ECMAScript uses resolve and reject. Windows uses ...
6 years, 10 months ago (2014-02-11 22:40:37 UTC) #9
robliao
6 years, 10 months ago (2014-02-12 18:07:16 UTC) #10
rgustafson
lgtm
6 years, 10 months ago (2014-02-12 18:22:03 UTC) #11
robliao
vadimt: Please provide owner approval for this CL.
6 years, 10 months ago (2014-02-12 18:54:29 UTC) #12
skare_
https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js#newcode1091 chrome/browser/resources/google_now/background.js:1091: isSignedIn(), ok if it makes things easier later; the ...
6 years, 10 months ago (2014-02-12 19:55:57 UTC) #13
robliao
https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/158003003/diff/200001/chrome/browser/resources/google_now/background.js#newcode1091 chrome/browser/resources/google_now/background.js:1091: isSignedIn(), That's one of them. The other is here: ...
6 years, 10 months ago (2014-02-12 20:57:25 UTC) #14
vadimt
On 2014/02/12 18:54:29, robliao wrote: > vadimt: Please provide owner approval for this CL. After ...
6 years, 10 months ago (2014-02-12 21:05:48 UTC) #15
robliao
On 2014/02/12 21:05:48, vadimt wrote: > On 2014/02/12 18:54:29, robliao wrote: > > vadimt: Please ...
6 years, 10 months ago (2014-02-12 21:11:17 UTC) #16
vadimt
To clarify: are expecting skare@ to provide LGTM at some point? If so, it makes ...
6 years, 10 months ago (2014-02-12 21:19:21 UTC) #17
vadimt
On 2014/02/12 21:19:21, vadimt wrote: > To clarify: are expecting skare@ to provide LGTM at ...
6 years, 10 months ago (2014-02-12 21:20:19 UTC) #18
robliao
On 2014/02/12 21:19:21, vadimt wrote: > To clarify: are expecting skare@ to provide LGTM at ...
6 years, 10 months ago (2014-02-12 21:20:35 UTC) #19
skare_
lgtm https://codereview.chromium.org/158003003/diff/360001/chrome/browser/resources/google_now/common_test_util.js File chrome/browser/resources/google_now/common_test_util.js (right): https://codereview.chromium.org/158003003/diff/360001/chrome/browser/resources/google_now/common_test_util.js#newcode92 chrome/browser/resources/google_now/common_test_util.js:92: callback.apply(null, result); this works, just curious - could ...
6 years, 10 months ago (2014-02-12 22:39:03 UTC) #20
vadimt
REAL LGTM
6 years, 10 months ago (2014-02-12 22:54:12 UTC) #21
robliao
https://codereview.chromium.org/158003003/diff/360001/chrome/browser/resources/google_now/common_test_util.js File chrome/browser/resources/google_now/common_test_util.js (right): https://codereview.chromium.org/158003003/diff/360001/chrome/browser/resources/google_now/common_test_util.js#newcode92 chrome/browser/resources/google_now/common_test_util.js:92: callback.apply(null, result); Done. On 2014/02/12 22:39:03, Travis Skare wrote: ...
6 years, 10 months ago (2014-02-12 23:57:20 UTC) #22
robliao
The CQ bit was checked by robliao@chromium.org
6 years, 10 months ago (2014-02-12 23:57:57 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/robliao@chromium.org/158003003/520001
6 years, 10 months ago (2014-02-13 00:01:33 UTC) #24
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-13 02:21:46 UTC) #25
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) app_list_unittests, ash_unittests, aura_unittests, cacheinvalidation_unittests, cc_unittests, check_deps, ...
6 years, 10 months ago (2014-02-13 02:21:46 UTC) #26
robliao
The CQ bit was checked by robliao@chromium.org
6 years, 10 months ago (2014-02-13 04:48:25 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/robliao@chromium.org/158003003/520001
6 years, 10 months ago (2014-02-13 04:48:48 UTC) #28
commit-bot: I haz the power
6 years, 10 months ago (2014-02-13 14:39:44 UTC) #29
Message was sent while issue was closed.
Change committed as 250992

Powered by Google App Engine
This is Rietveld 408576698