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

Issue 2226063002: Add a ScopedFeatureList class for testing and start using it. (Closed)

Created:
4 years, 4 months ago by Alexei Svitkine (slow)
Modified:
4 years, 4 months ago
CC:
chromium-reviews, vabr+watchlistpasswordmanager_chromium.org, dewittj+watch_chromium.org, rouslan+autofill_chromium.org, fgorski+watch_chromium.org, romax+watch_chromium.org, browser-components-watch_chromium.org, petewil+watch_chromium.org, jdonnelly+autofillwatch_chromium.org, chili+watch_chromium.org, asvitkine+watch_chromium.org, vabr+watchlistautofill_chromium.org, estade+watch_chromium.org, gcasto+watchlist_chromium.org, sync-reviews_chromium.org, dimich+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add a ScopedFeatureList class for testing and start using it. This class improves upon the current situation by ensuring a test doesn't end up modifying the global feature list permanently. Migrates a number of tests to new the scoped class. BUG=620435 TBR=jochen@chromium.org Committed: https://crrev.com/9499b8d28ace546ebe511b777fa3529421ecc256 Cr-Commit-Position: refs/heads/master@{#410589}

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : build files #

Patch Set 4 : . #

Total comments: 12

Patch Set 5 : Addressed comments. #

Patch Set 6 : Fix issue in previous patchset. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+249 lines, -226 lines) Patch
M base/feature_list.h View 1 2 3 4 1 chunk +10 lines, -2 lines 0 comments Download
M base/feature_list.cc View 2 chunks +12 lines, -2 lines 0 comments Download
M base/test/BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
A base/test/scoped_feature_list.h View 1 chunk +51 lines, -0 lines 0 comments Download
A base/test/scoped_feature_list.cc View 1 chunk +50 lines, -0 lines 0 comments Download
M chrome/browser/password_manager/chrome_password_manager_client_unittest.cc View 1 2 3 2 chunks +4 lines, -7 lines 0 comments Download
M components/autofill/core/browser/autofill_assistant_unittest.cc View 3 chunks +3 lines, -5 lines 0 comments Download
M components/autofill/core/browser/autofill_manager_unittest.cc View 4 chunks +3 lines, -2 lines 0 comments Download
M components/autofill/core/browser/autofill_merge_unittest.cc View 3 chunks +3 lines, -6 lines 0 comments Download
M components/autofill/core/browser/personal_data_manager_unittest.cc View 5 chunks +6 lines, -13 lines 0 comments Download
M components/browser_sync/browser/profile_sync_service_unittest.cc View 4 chunks +10 lines, -9 lines 0 comments Download
M components/flags_ui/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M components/flags_ui/flags_state_unittest.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M components/network_time/network_time_tracker_unittest.cc View 5 chunks +7 lines, -4 lines 0 comments Download
M components/offline_pages/offline_page_model_impl_unittest.cc View 2 chunks +24 lines, -38 lines 0 comments Download
M components/password_manager/core/browser/password_form_manager_unittest.cc View 1 2 3 4 5 2 chunks +5 lines, -9 lines 0 comments Download
M components/password_manager/core/browser/password_manager_test_utils.h View 1 chunk +0 lines, -7 lines 0 comments Download
M components/password_manager/core/browser/password_manager_test_utils.cc View 2 chunks +0 lines, -26 lines 0 comments Download
M components/password_manager/core/browser/password_manager_unittest.cc View 4 chunks +7 lines, -22 lines 0 comments Download
M components/password_manager/sync/browser/sync_credentials_filter_unittest.cc View 4 chunks +15 lines, -18 lines 0 comments Download
M components/ssl_config/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M components/ssl_config/ssl_config_service_manager_pref_unittest.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M components/subresource_filter/core/browser/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M components/subresource_filter/core/browser/subresource_filter_features_test_support.h View 2 chunks +3 lines, -0 lines 0 comments Download
M components/subresource_filter/core/browser/subresource_filter_features_test_support.cc View 2 chunks +1 line, -3 lines 0 comments Download
M components/translate/core/browser/translate_prefs_unittest.cc View 2 chunks +3 lines, -10 lines 0 comments Download
M components/translate/core/browser/translate_ui_delegate_unittest.cc View 3 chunks +3 lines, -7 lines 0 comments Download
M components/variations/service/variations_service_unittest.cc View 3 chunks +0 lines, -12 lines 0 comments Download
M components/variations/variations_associated_data_unittest.cc View 3 chunks +11 lines, -10 lines 0 comments Download
M components/variations/variations_seed_processor_unittest.cc View 8 chunks +7 lines, -8 lines 0 comments Download

Messages

Total messages: 35 (22 generated)
Alexei Svitkine (slow)
isherman: PTAL for the feature list code in base/ and base/test
4 years, 4 months ago (2016-08-09 00:48:56 UTC) #10
Ilya Sherman
Awesome! LGTM % nits. https://codereview.chromium.org/2226063002/diff/60001/base/feature_list.h File base/feature_list.h (right): https://codereview.chromium.org/2226063002/diff/60001/base/feature_list.h#newcode170 base/feature_list.h:170: // Note: Most tests should ...
4 years, 4 months ago (2016-08-09 01:06:57 UTC) #13
Alexei Svitkine (slow)
https://codereview.chromium.org/2226063002/diff/60001/base/feature_list.h File base/feature_list.h (right): https://codereview.chromium.org/2226063002/diff/60001/base/feature_list.h#newcode170 base/feature_list.h:170: // Note: Most tests should never call this directly, ...
4 years, 4 months ago (2016-08-09 01:26:16 UTC) #14
Alexei Svitkine (slow)
+TBR jochen@chromium.org for downstream owners. TBRing since this is essentially an API change.
4 years, 4 months ago (2016-08-09 01:29:57 UTC) #16
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/2226063002/80001
4 years, 4 months ago (2016-08-09 01:32:26 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: chromeos_x86-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-generic_chromium_compile_only_ng/builds/180117)
4 years, 4 months ago (2016-08-09 01:41:10 UTC) #22
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/2226063002/80001
4 years, 4 months ago (2016-08-09 02:45:23 UTC) #24
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/2226063002/100001
4 years, 4 months ago (2016-08-09 02:58:09 UTC) #27
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 4 months ago (2016-08-09 05:37:27 UTC) #29
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/9499b8d28ace546ebe511b777fa3529421ecc256 Cr-Commit-Position: refs/heads/master@{#410589}
4 years, 4 months ago (2016-08-09 05:40:31 UTC) #31
Ilya Sherman
https://codereview.chromium.org/2226063002/diff/60001/base/test/scoped_feature_list.h File base/test/scoped_feature_list.h (right): https://codereview.chromium.org/2226063002/diff/60001/base/test/scoped_feature_list.h#newcode24 base/test/scoped_feature_list.h:24: void Init(); On 2016/08/09 01:26:16, Alexei Svitkine (very slow) ...
4 years, 4 months ago (2016-08-09 06:15:12 UTC) #32
vabr (Chromium)
You don't need my approval, but I had to say that this LGTM. In fact, ...
4 years, 4 months ago (2016-08-09 07:04:25 UTC) #34
Alexei Svitkine (slow)
4 years, 4 months ago (2016-08-09 15:27:43 UTC) #35
Message was sent while issue was closed.
https://codereview.chromium.org/2226063002/diff/60001/base/test/scoped_featur...
File base/test/scoped_feature_list.h (right):

https://codereview.chromium.org/2226063002/diff/60001/base/test/scoped_featur...
base/test/scoped_feature_list.h:24: void Init();
On 2016/08/09 06:15:12, Ilya Sherman wrote:
> On 2016/08/09 01:26:16, Alexei Svitkine (very slow) wrote:
> > On 2016/08/09 01:06:57, Ilya Sherman wrote:
> > > Optional nit: I think it would be cleaner if each of the Init methods were
a
> > > constructor -- that way, code doesn't need to first construct the object,
> and
> > > then init it.
> > 
> > That doesn't fit some use cases - where e.g. the scoped feature list is a
> member
> > of a test harness class and then *some* tests but not all initialize it to
> some
> > given state. I'll leave it as-is for now, but we can consider also adding
the
> > ctor params as a short hand syntax for not calling the Init functions.
> 
> FWIW, my preferred solution to that would be for the individual tests to
declare
> the scoped feature list, rather than having it be a member of the test harness
> class.

Okay, I can take a look at it when I plan to do my second pass in converting
existing tests, probably when I'll be traveling Thursday next week.

Powered by Google App Engine
This is Rietveld 408576698