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

Issue 789643004: Move chrome.alarms API from chrome/ to extensions/. (Closed)

Created:
5 years, 11 months ago by babu
Modified:
5 years, 10 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org, not at google - send to devlin
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move chrome.alarms API from chrome/ to extensions/. This CL allows app_shell to use chrome.alarms. Also it includes the following changes related to unit tests: - Moved chrome.alarms tests to extensions/ - Moved a helper function CreateEmptyExtensionWithLocation() from extension_function_test_utils.h to api_test_utils.h. - Moved CreateBackgroundPage() from extension_api_unittest.h to api_unittest.h. - Creates WebContents for the extension that can be used to associate a RenderViewHost in extension unit tests. BUG=443622 Committed: https://crrev.com/745ff1db8cca6a4fdc0c19cf3edab909bd532457 Cr-Commit-Position: refs/heads/master@{#314040}

Patch Set 1 #

Total comments: 7

Patch Set 2 : Addressed review comments. #

Patch Set 3 : Move tests to extensions/. #

Total comments: 12

Patch Set 4 : Fixed review comments. #

Total comments: 1

Patch Set 5 : Applied fix provided by Ken for docserver tests. #

Patch Set 6 : Rebased #

Patch Set 7 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+288 lines, -2047 lines) Patch
M chrome/browser/apps/ephemeral_app_browsertest.cc View 3 chunks +2 lines, -2 lines 0 comments Download
D chrome/browser/extensions/api/alarms/OWNERS View 1 chunk +0 lines, -1 line 0 comments Download
D chrome/browser/extensions/api/alarms/alarm_manager.h View 1 chunk +0 lines, -247 lines 0 comments Download
D chrome/browser/extensions/api/alarms/alarm_manager.cc View 1 chunk +0 lines, -470 lines 0 comments Download
D chrome/browser/extensions/api/alarms/alarms_api.h View 1 chunk +0 lines, -92 lines 0 comments Download
D chrome/browser/extensions/api/alarms/alarms_api.cc View 1 chunk +0 lines, -206 lines 0 comments Download
M chrome/browser/extensions/api/alarms/alarms_api_unittest.cc View 1 2 1 chunk +0 lines, -667 lines 0 comments Download
M chrome/browser/extensions/browser_context_keyed_service_factories.cc View 1 2 3 4 5 6 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_api_unittest.h View 1 2 3 4 chunks +0 lines, -15 lines 0 comments Download
M chrome/browser/extensions/extension_api_unittest.cc View 1 2 3 4 chunks +4 lines, -19 lines 0 comments Download
M chrome/browser/extensions/extension_function_test_utils.h View 1 2 3 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/extensions/extension_function_test_utils.cc View 1 2 3 1 chunk +0 lines, -9 lines 0 comments Download
M chrome/chrome_browser_extensions.gypi View 1 2 3 4 5 6 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M chrome/common/extensions/api/_api_features.json View 1 2 3 4 5 6 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/common/extensions/api/_permission_features.json View 1 2 3 4 5 6 1 chunk +0 lines, -5 lines 0 comments Download
D chrome/common/extensions/api/alarms.idl View 1 chunk +0 lines, -96 lines 0 comments Download
M chrome/common/extensions/api/schemas.gypi View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M chrome/common/extensions/docs/server2/api_models_test.py View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/common/extensions/docs/server2/platform_bundle_test.py View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/common/extensions/permissions/chrome_api_permissions.cc View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M extensions/browser/BUILD.gn View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
A + extensions/browser/api/alarms/OWNERS View 0 chunks +-1 lines, --1 lines 0 comments Download
A + extensions/browser/api/alarms/alarm_manager.h View 1 3 9 chunks +14 lines, -17 lines 0 comments Download
A + extensions/browser/api/alarms/alarm_manager.cc View 15 chunks +44 lines, -47 lines 0 comments Download
A + extensions/browser/api/alarms/alarms_api.h View 1 7 chunks +11 lines, -10 lines 0 comments Download
A + extensions/browser/api/alarms/alarms_api.cc View 8 chunks +28 lines, -28 lines 0 comments Download
A + extensions/browser/api/alarms/alarms_api_unittest.cc View 1 2 3 33 chunks +113 lines, -94 lines 0 comments Download
M extensions/browser/api_test_utils.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M extensions/browser/api_test_utils.cc View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M extensions/browser/api_unittest.h View 1 2 3 4 chunks +11 lines, -0 lines 0 comments Download
M extensions/browser/api_unittest.cc View 1 2 3 4 chunks +18 lines, -2 lines 0 comments Download
M extensions/browser/browser_context_keyed_service_factories.cc View 1 2 3 4 5 6 2 chunks +2 lines, -0 lines 0 comments Download
M extensions/browser/extensions_test.h View 1 2 3 4 5 6 3 chunks +6 lines, -0 lines 0 comments Download
M extensions/common/api/_api_features.json View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M extensions/common/api/_permission_features.json View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
A + extensions/common/api/alarms.idl View 0 chunks +-1 lines, --1 lines 0 comments Download
M extensions/common/api/schemas.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M extensions/common/permissions/extensions_api_permissions.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M extensions/extensions.gyp View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M extensions/extensions_tests.gyp View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 41 (10 generated)
babu
5 years, 11 months ago (2015-01-05 12:34:24 UTC) #2
James Cook
Looking good, but please move the unit test to //extensions as well. https://codereview.chromium.org/789643004/diff/1/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc File chrome/browser/extensions/api/alarms/alarms_api_unittest.cc ...
5 years, 11 months ago (2015-01-05 19:22:43 UTC) #3
babu
Sorry for the late response. https://codereview.chromium.org/789643004/diff/1/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc File chrome/browser/extensions/api/alarms/alarms_api_unittest.cc (right): https://codereview.chromium.org/789643004/diff/1/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc#newcode1 chrome/browser/extensions/api/alarms/alarms_api_unittest.cc:1: // Copyright (c) 2012 ...
5 years, 11 months ago (2015-01-16 19:32:37 UTC) #4
James Cook
https://codereview.chromium.org/789643004/diff/1/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc File chrome/browser/extensions/api/alarms/alarms_api_unittest.cc (right): https://codereview.chromium.org/789643004/diff/1/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc#newcode1 chrome/browser/extensions/api/alarms/alarms_api_unittest.cc:1: // Copyright (c) 2012 The Chromium Authors. All rights ...
5 years, 11 months ago (2015-01-16 20:56:31 UTC) #5
babu
On 2015/01/16 20:56:31, James Cook wrote: > RenderViewHost and RenderViewHostTestEnabler are in //content, which can ...
5 years, 11 months ago (2015-01-16 23:08:51 UTC) #6
babu
https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/alarms/alarm_manager.h File extensions/browser/api/alarms/alarm_manager.h (right): https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/alarms/alarm_manager.h#newcode213 extensions/browser/api/alarms/alarm_manager.h:213: static const bool kServiceIsCreatedWithBrowserContext = false; I'm not very ...
5 years, 11 months ago (2015-01-16 23:32:28 UTC) #7
James Cook
Looking better! https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/alarms/alarm_manager.h File extensions/browser/api/alarms/alarm_manager.h (right): https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/alarms/alarm_manager.h#newcode213 extensions/browser/api/alarms/alarm_manager.h:213: static const bool kServiceIsCreatedWithBrowserContext = false; On ...
5 years, 11 months ago (2015-01-17 00:51:29 UTC) #8
babu
https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/alarms/alarm_manager.h File extensions/browser/api/alarms/alarm_manager.h (right): https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/alarms/alarm_manager.h#newcode213 extensions/browser/api/alarms/alarm_manager.h:213: static const bool kServiceIsCreatedWithBrowserContext = false; On 2015/01/17 00:51:28, ...
5 years, 11 months ago (2015-01-17 11:53:56 UTC) #12
James Cook
LGTM. Nice patch! https://codereview.chromium.org/789643004/diff/120001/chrome/browser/extensions/extension_function_test_utils.h File chrome/browser/extensions/extension_function_test_utils.h (left): https://codereview.chromium.org/789643004/diff/120001/chrome/browser/extensions/extension_function_test_utils.h#oldcode46 chrome/browser/extensions/extension_function_test_utils.h:46: extensions::Manifest::Location location); Hooray, it's great that ...
5 years, 11 months ago (2015-01-20 17:54:14 UTC) #13
babu
+thestig@ for chrome/
5 years, 11 months ago (2015-01-21 08:08:37 UTC) #15
Lei Zhang
chrome/ lgtm, but you may need to update chrome/common/extensions/docs/server2/platform_bundle_test.py since it references alarms.idl. +kalman, +rockot
5 years, 11 months ago (2015-01-21 09:09:41 UTC) #16
Ken Rockot(use gerrit already)
On 2015/01/21 09:09:41, Lei Zhang wrote: > chrome/ lgtm, but you may need to update ...
5 years, 11 months ago (2015-01-21 16:51:36 UTC) #17
babu
On 2015/01/21 16:51:36, Ken Rockot wrote: > On 2015/01/21 09:09:41, Lei Zhang wrote: > > ...
5 years, 11 months ago (2015-01-21 22:22:22 UTC) #19
babu
yoz@, could you please take a look at //extensions?
5 years, 11 months ago (2015-01-22 06:15:56 UTC) #20
Yoyo Zhou
extensions LGTM
5 years, 11 months ago (2015-01-23 06:22:40 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/789643004/160001
5 years, 11 months ago (2015-01-27 08:44:17 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/38537) Try jobs failed on following ...
5 years, 11 months ago (2015-01-27 09:24:07 UTC) #25
James Cook
On 2015/01/27 09:24:07, I haz the power (commit-bot) wrote: > Try jobs failed on following ...
5 years, 11 months ago (2015-01-27 15:59:58 UTC) #26
Ken Rockot(use gerrit already)
+Meggin: Didn't you change some redirect(s) recently, or am I remembering incorrectly? The failing docserver ...
5 years, 11 months ago (2015-01-27 16:12:36 UTC) #28
chromium-reviews
Yes, I changed a redirect recently. I'll take a look. On Tue, Jan 27, 2015 ...
5 years, 11 months ago (2015-01-27 17:28:50 UTC) #29
mkearney1
On 2015/01/27 17:28:50, chromium-reviews wrote: > Yes, I changed a redirect recently. I'll take a ...
5 years, 11 months ago (2015-01-28 00:17:51 UTC) #30
babu
On 2015/01/28 00:17:51, mkearney1 wrote: > On 2015/01/27 17:28:50, chromium-reviews wrote: > > Yes, I ...
5 years, 10 months ago (2015-01-29 16:09:35 UTC) #31
Ken Rockot(use gerrit already)
On 2015/01/29 16:09:35, babu wrote: > On 2015/01/28 00:17:51, mkearney1 wrote: > > On 2015/01/27 ...
5 years, 10 months ago (2015-01-29 17:59:48 UTC) #32
chromium-reviews
Yeah, so sorry about this. The weird thing is that we were able to put ...
5 years, 10 months ago (2015-01-29 19:15:47 UTC) #33
chromium-reviews
Hi, everyone I put through a fix, which worked, but only part of the way. ...
5 years, 10 months ago (2015-01-30 00:52:08 UTC) #34
babu
Meggin and Ken, thanks a lot for looking into those test failures - very much ...
5 years, 10 months ago (2015-01-30 10:29:05 UTC) #35
chromium-reviews
Hey, guys Sorry this took so long-- I finally got a success on the integration ...
5 years, 10 months ago (2015-01-30 20:55:47 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/789643004/180001
5 years, 10 months ago (2015-01-30 23:35:34 UTC) #38
commit-bot: I haz the power
Committed patchset #7 (id:180001)
5 years, 10 months ago (2015-01-31 00:26:50 UTC) #39
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/745ff1db8cca6a4fdc0c19cf3edab909bd532457 Cr-Commit-Position: refs/heads/master@{#314040}
5 years, 10 months ago (2015-01-31 00:28:02 UTC) #40
Lei Zhang
5 years, 10 months ago (2015-02-02 22:58:30 UTC) #41
Message was sent while issue was closed.
https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/a...
File extensions/browser/api/alarms/alarm_manager.h (right):

https://codereview.chromium.org/789643004/diff/40001/extensions/browser/api/a...
extensions/browser/api/alarms/alarm_manager.h:213: static const bool
kServiceIsCreatedWithBrowserContext = false;
On 2015/01/17 11:53:56, babu wrote:
> On 2015/01/17 00:51:28, James Cook wrote:
> > On 2015/01/16 23:32:28, babu wrote:
> > > I'm not very sure about this change, but without this tests were crashing
> with
> > > the following trace.
> > > 
> > > #2 0x7f6c08a9bbb0 <unknown>
> > > #3 0x00000085c115 extensions::ExtensionSystem::Get()
> > > #4 0x00000081eb82 extensions::AlarmManager::AlarmManager()
> > > #5 0x00000081ec41
> > > extensions::BrowserContextKeyedAPIFactory<>::BuildServiceInstanceFor()
> > > #6 0x7f6c0eae2ace KeyedServiceFactory::GetServiceForContext()
> > > #7 0x7f6c0eae2155 DependencyManager::CreateContextServices()
> > > #8 0x7f6c0ebd9480
> > > BrowserContextDependencyManager::DoCreateBrowserContextServices()
> > > #9 0x0000007478e9 extensions::ApiUnitTest::SetUp()
> > > #10 0x00000047affc extensions::ExtensionAlarmsTest::SetUp()
> > > #11 0x0000006d990d testing::Test::Run()
> > 
> > It's unclear to me that this change is safe. It changes the creation time of
> > AlarmManager and I'm not sure what effect that has in Chrome. If the
> suggestion
> > below doesn't help we can try to figure out if it's OK to lazily create this
> > service.  It does something to "StateStore" in the constructor I'm not
> familiar
> > with.
> > 
> > That said, I think you just found a bug in ApiUnitTest! ApiUnitTest::SetUp()
> > calls ExtensionsTest::SetUp() which tries to build
> BrowserContextKeyedServices,
> > but there's no ExtensionSystemFactory yet.  Can you try moving the call to
> > set_extension_system_factory() into the ApiUnitTest constructor and see what
> > happens?
> 
> Thanks for the suggestion, it fixes the problem.

But it only fixes the problem for ExtensionAlarmsSchedulingTest it seems. The
tests that run after it still crashes. I've filed http://crbug.com/454554 and
I'm trying out avoiding to call ExtensionSystem::Get() in the AlarmManager ctor.

Powered by Google App Engine
This is Rietveld 408576698