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

Issue 1776903002: Refactor BrowsingDataRemover to mock out WebappRegistry. (Closed)

Created:
4 years, 9 months ago by dominickn
Modified:
4 years, 9 months ago
Reviewers:
Mike West, gone
CC:
chrome-apps-syd-reviews_chromium.org, chromium-reviews, markusheintz_
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor BrowsingDataRemover to mock out WebappRegistry. WebappRegistry makes JNI calls from the browsing data remover. This interferes with C++ unit tests, as the Java side code is not initialised in these tests. Any C++ unit test which calls through the JNI will hang and time out. This CL refactors the static methods in WebappRegistry into instance methods, and adds a scoped pointer to WebappRegistry as a member on BrowsingDataRemover. This allows the class to be mocked out at test time to prevent the JNI call; thus browsing data remover tests which trigger JNI calls can be run on Android. A follow-up CL will add a JNI call on history removal to the browsing data remover; this pathway is currently used in C++ unit tests and will hang without the mocking implemented in this CL. WebappRegistry only exists on Android, and there is no reason for it to exist on a desktop build. Thus, this patch uses #if BUILDFLAG to ensure the registry pointer and method calls are only present on Android. BUG=570579 Committed: https://crrev.com/ce31ade9a645c56b5d5be16acffa6b8f81e8748e Cr-Commit-Position: refs/heads/master@{#380541}

Patch Set 1 #

Patch Set 2 : Rebase #

Total comments: 3

Patch Set 3 : Use PostDelayedTask #

Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -9 lines) Patch
M chrome/browser/android/webapps/webapp_registry.h View 1 chunk +8 lines, -4 lines 0 comments Download
M chrome/browser/android/webapps/webapp_registry.cc View 2 chunks +2 lines, -4 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover.h View 1 3 chunks +15 lines, -0 lines 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover.cc View 1 3 chunks +11 lines, -1 line 0 comments Download
M chrome/browser/browsing_data/browsing_data_remover_unittest.cc View 1 2 3 chunks +24 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 24 (9 generated)
dominickn
mkwst: PTAL at the browsing data remover dfalcantara: PTAL at the webapp registry Thanks! This ...
4 years, 9 months ago (2016-03-09 06:25:33 UTC) #3
Mike West
BDR LGTM. Thanks!
4 years, 9 months ago (2016-03-09 07:18:37 UTC) #4
gone
https://chromiumcodereview.appspot.com/1776903002/diff/20001/chrome/browser/browsing_data/browsing_data_remover_unittest.cc File chrome/browser/browsing_data/browsing_data_remover_unittest.cc (right): https://chromiumcodereview.appspot.com/1776903002/diff/20001/chrome/browser/browsing_data/browsing_data_remover_unittest.cc#newcode274 chrome/browser/browsing_data/browsing_data_remover_unittest.cc:274: callback.Run(); Should this be a delayed task, like with ...
4 years, 9 months ago (2016-03-10 00:18:06 UTC) #5
dominickn
https://codereview.chromium.org/1776903002/diff/20001/chrome/browser/browsing_data/browsing_data_remover_unittest.cc File chrome/browser/browsing_data/browsing_data_remover_unittest.cc (right): https://codereview.chromium.org/1776903002/diff/20001/chrome/browser/browsing_data/browsing_data_remover_unittest.cc#newcode274 chrome/browser/browsing_data/browsing_data_remover_unittest.cc:274: callback.Run(); On 2016/03/10 00:18:06, dfalcantara wrote: > Should this ...
4 years, 9 months ago (2016-03-10 00:30:45 UTC) #6
gone
https://codereview.chromium.org/1776903002/diff/20001/chrome/browser/browsing_data/browsing_data_remover_unittest.cc File chrome/browser/browsing_data/browsing_data_remover_unittest.cc (right): https://codereview.chromium.org/1776903002/diff/20001/chrome/browser/browsing_data/browsing_data_remover_unittest.cc#newcode274 chrome/browser/browsing_data/browsing_data_remover_unittest.cc:274: callback.Run(); On 2016/03/10 00:30:45, dominickn wrote: > On 2016/03/10 ...
4 years, 9 months ago (2016-03-10 00:45:07 UTC) #7
dominickn
Acknowledged. I've changed it to use a delayed task, thanks! mkwst, do you want to ...
4 years, 9 months ago (2016-03-10 01:48:22 UTC) #8
gone
Nah, you're golden. Thanks! lgtm
4 years, 9 months ago (2016-03-10 01:50:38 UTC) #9
Mike West
BDR still LGTM. :)
4 years, 9 months ago (2016-03-10 08:45:40 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1776903002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1776903002/40001
4 years, 9 months ago (2016-03-10 23:16:36 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/129092)
4 years, 9 months ago (2016-03-11 00:27:59 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1776903002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1776903002/40001
4 years, 9 months ago (2016-03-11 00:32:00 UTC) #16
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/129209)
4 years, 9 months ago (2016-03-11 01:43:18 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1776903002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1776903002/40001
4 years, 9 months ago (2016-03-11 04:28:57 UTC) #20
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 9 months ago (2016-03-11 05:39:35 UTC) #22
commit-bot: I haz the power
4 years, 9 months ago (2016-03-11 05:41:22 UTC) #24
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/ce31ade9a645c56b5d5be16acffa6b8f81e8748e
Cr-Commit-Position: refs/heads/master@{#380541}

Powered by Google App Engine
This is Rietveld 408576698