Processing timefences from the server.
Timefences, or triggers, are commands inside cards data that tell the client to show / hide the card at certain time without making a server request.
BUG=164227
TEST=Need to discuss in person.
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=214058
https://codereview.chromium.org/19749007/diff/10001/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): https://codereview.chromium.org/19749007/diff/10001/chrome/test/data/webui/test_api.js#newcode1618 chrome/test/data/webui/test_api.js:1618: * Checks that JSON represenation of the actual and ...
7 years, 5 months ago
(2013-07-23 18:14:02 UTC)
#5
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/google_now/cards.js File chrome/browser/resources/google_now/cards.js (right): https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/google_now/cards.js#newcode104 chrome/browser/resources/google_now/cards.js:104: // this doesn't output an error to console. up ...
7 years, 5 months ago
(2013-07-23 19:55:55 UTC)
#6
https://codereview.chromium.org/19749007/diff/10001/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): https://codereview.chromium.org/19749007/diff/10001/chrome/test/data/webui/test_api.js#newcode1618 chrome/test/data/webui/test_api.js:1618: * Checks that JSON represenation of the actual and ...
7 years, 5 months ago
(2013-07-23 20:03:27 UTC)
#7
7 years, 5 months ago
(2013-07-23 21:20:40 UTC)
#8
lgtm
skare_
couple more high level things, might not require any action, just sending out because I ...
7 years, 5 months ago
(2013-07-23 21:25:52 UTC)
#9
couple more high level things, might not require any action, just sending out
because I have to review the test still and we can parallelize.
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
File chrome/browser/resources/google_now/cards.js (right):
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:35: * @param {Object}
cardCreateInfo Google Now card represented as a set of
worth typedef'ing this or documenting the structure? Or will the scope be
limited to pretty much what's in the code at this point?
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:104: // this doesn't output an
error to console.
On 2013/07/23 20:03:28, vadimt wrote:
> On 2013/07/23 19:55:56, Travis Skare wrote:
> > up to you, but this might be worth checking for this cl.
>
> This depends on another CL (task improvements) that allows branching tasks.
> Or, extension guys could make this message non-error.
> Both are not a good match for this CL.
[no action required]
ah ok, I think I misunderstood "make sure" -- my original reading was that you'd
want to experiment with clearing nonexistent alarms to see what the outcome was,
rather than already knowing it would raise an exception or log an error.
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:147:
chrome.alarms.clear(cardHidePrefix + cardId);
similar to the above, the behavior for a nonexistent alarm is to console.error
but not suspend execution? that is, both of these statements will run even if
(showPrefix+id) is not an alarm?
vadimt
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/google_now/cards.js File chrome/browser/resources/google_now/cards.js (right): https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/google_now/cards.js#newcode35 chrome/browser/resources/google_now/cards.js:35: * @param {Object} cardCreateInfo Google Now card represented as ...
7 years, 5 months ago
(2013-07-23 22:42:33 UTC)
#10
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
File chrome/browser/resources/google_now/cards.js (right):
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:35: * @param {Object}
cardCreateInfo Google Now card represented as a set of
On 2013/07/23 21:25:53, Travis Skare wrote:
> worth typedef'ing this or documenting the structure? Or will the scope be
> limited to pretty much what's in the code at this point?
1. Scope will be as limited as it is now. This structure won't be used outside
of card manager.
2. The structure contains notification fields received from the server, so we
anyways cannot fully define it.
https://codereview.chromium.org/19749007/diff/27001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:147:
chrome.alarms.clear(cardHidePrefix + cardId);
On 2013/07/23 21:25:53, Travis Skare wrote:
> similar to the above, the behavior for a nonexistent alarm is to console.error
> but not suspend execution? that is, both of these statements will run even if
> (showPrefix+id) is not an alarm?
It's all about red diagnostic output. But the execution happily continues.
skare_
lgtm
7 years, 5 months ago
(2013-07-24 23:49:36 UTC)
#11
lgtm
vadimt
OWNERs, please provide approvals: arv@: chrome/browser/resources/* sky@: chrome/chrome_tests_unit.gypi chrome/test/data/webui/test_api.js NOTES: 1. Changes in test_api.js are ...
7 years, 5 months ago
(2013-07-25 00:20:15 UTC)
#12
OWNERs, please provide approvals:
arv@:
chrome/browser/resources/*
sky@:
chrome/chrome_tests_unit.gypi
chrome/test/data/webui/test_api.js
NOTES:
1. Changes in test_api.js are simply moving code from background_test_util.js
2. sky@, IIRC, you are not a JS person. arv@, can I ask you to look at
test_api.js changes, while sky@ could just provide a rubberstamp for it?
sky
LGTM as long as arv is happy https://codereview.chromium.org/19749007/diff/37001/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): https://codereview.chromium.org/19749007/diff/37001/chrome/test/data/webui/test_api.js#newcode1634 chrome/test/data/webui/test_api.js:1634: } nit: ...
7 years, 5 months ago
(2013-07-25 14:51:22 UTC)
#13
Oops, arv@ is in today. xiyuan, please do nothing for now!
7 years, 5 months ago
(2013-07-25 21:48:29 UTC)
#17
Oops, arv@ is in today. xiyuan, please do nothing for now!
vadimt
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/google_now/cards.js File chrome/browser/resources/google_now/cards.js (right): https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/google_now/cards.js#newcode5 chrome/browser/resources/google_now/cards.js:5: 'use strict'; On 2013/07/25 21:45:27, arv wrote: > Are ...
7 years, 5 months ago
(2013-07-25 22:57:20 UTC)
#18
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
File chrome/browser/resources/google_now/cards.js (right):
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:5: 'use strict';
On 2013/07/25 21:45:27, arv wrote:
> Are these files getting concatted?
>
> Usually, it is bad to put 'use strict' at the top level. Can you put this in
an
> IIFE?
This is one of a page's scripts. Another script of this page depends on its
functions.
I tried surrounding the whole file with an anonymous function, but then exported
methods become local, and I cannot use them outside of the file.
Did you mean something different from a huge anonymous function?
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:13: function buildCardManager() {
On 2013/07/25 21:45:27, arv wrote:
> don't name things "manager"
Done.
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:13: function buildCardManager() {
On 2013/07/25 21:45:27, arv wrote:
> Use constructor and prototypes if you need multiple objects.
>
> Use the module pattern for a single object
Module doesn't work well. It creates a variable right here.
However, in my unit tests, I want to call buildCardManager() and check that this
method has correct side effects (like hooking to certain events). I cannot
beautifully do this with a module since by the time a test runs, the module is
already created.
Alternatively, I could declare this as a constructor and a prototype, but this
is inadequate because I create only 1 instance. So, it seems like the current
approach is the most adequate.
Convincing?
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
File chrome/browser/resources/google_now/cards_unittest.gtestjs (right):
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards_unittest.gtestjs:24: var
testNotification = { testNotificationField: 'TEST NOTIFICATION VALUE' };
On 2013/07/25 21:45:27, arv wrote:
> no ws after { nor before }
Done.
skare_
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/google_now/cards.js File chrome/browser/resources/google_now/cards.js (right): https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/google_now/cards.js#newcode5 chrome/browser/resources/google_now/cards.js:5: 'use strict'; On 2013/07/25 22:57:20, vadimt wrote: > On ...
7 years, 5 months ago
(2013-07-26 00:57:29 UTC)
#19
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
File chrome/browser/resources/google_now/cards.js (right):
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:5: 'use strict';
On 2013/07/25 22:57:20, vadimt wrote:
> On 2013/07/25 21:45:27, arv wrote:
> > Are these files getting concatted?
> >
> > Usually, it is bad to put 'use strict' at the top level. Can you put this in
> an
> > IIFE?
>
> This is one of a page's scripts. Another script of this page depends on its
> functions.
> I tried surrounding the whole file with an anonymous function, but then
exported
> methods become local, and I cannot use them outside of the file.
> Did you mean something different from a huge anonymous function?
(function(){
window['thefunction'] = thefunction?
})();
?
for reference see also goog.exportSymbol and @export from Closure (though we
don't use it here)
7 years, 5 months ago
(2013-07-26 01:08:54 UTC)
#20
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
File chrome/browser/resources/google_now/cards.js (right):
https://codereview.chromium.org/19749007/diff/47001/chrome/browser/resources/...
chrome/browser/resources/google_now/cards.js:5: 'use strict';
On 2013/07/26 00:57:29, Travis Skare wrote:
> On 2013/07/25 22:57:20, vadimt wrote:
> > On 2013/07/25 21:45:27, arv wrote:
> > > Are these files getting concatted?
> > >
> > > Usually, it is bad to put 'use strict' at the top level. Can you put this
in
> > an
> > > IIFE?
> >
> > This is one of a page's scripts. Another script of this page depends on its
> > functions.
> > I tried surrounding the whole file with an anonymous function, but then
> exported
> > methods become local, and I cannot use them outside of the file.
> > Did you mean something different from a huge anonymous function?
>
> (function(){
> window['thefunction'] = thefunction?
> })();
> ?
> for reference see also goog.exportSymbol and @export from Closure (though we
> don't use it here)
Since I use unit testing, I want to export every function, to be able to test
and mock individual functions. Then, the code (if we apply this rule everywhere)
would become so ugly that the benefits of placing 'use strict' in an IIFE fade.
Speaking of benefits. Given that this code entirely belongs to the extension and
won't be used outside of it, there are not so many benefits in such isolation...
Anyways, technically, I can do what you ask, but I feel that the bottom line
will be losing rather than gaining.
Just let me know if you confirm that you still want me to do this.
xiyuan
LGTM
7 years, 5 months ago
(2013-07-26 17:40:31 UTC)
#21
LGTM
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/vadimt@chromium.org/19749007/57001
7 years, 5 months ago
(2013-07-26 17:47:28 UTC)
#22
Issue 19749007: Processing timefences from the server.
(Closed)
Created 7 years, 5 months ago by vadimt
Modified 7 years, 4 months ago
Reviewers: rgustafson, skare_, arv (Not doing code reviews), xiyuan
Base URL: svn://svn.chromium.org/chrome/trunk/src
Comments: 43