|
|
DescriptionSet Ash material design mode in tests properly
Currently, in Ash tests, material design mode is set after call to
AshTestBase::SetUp(). This is not right as some setup in AshTestBase
might depend on material mode. This CL allows setting material mode
before calling AshTestBase::SetUp().
BUG=620093
Committed: https://crrev.com/c66d687b9ffbd366ff3a1ca85acb6c0c4eab1ab1
Cr-Commit-Position: refs/heads/master@{#408837}
Patch Set 1 #Patch Set 2 : Cleanup #
Total comments: 1
Patch Set 3 : Rebased #Patch Set 4 : Fixed compile errors after rebase #
Total comments: 14
Patch Set 5 : Improved comments #Patch Set 6 : Rebased #
Total comments: 2
Patch Set 7 : Added a CHECK #
Total comments: 2
Patch Set 8 : Addressed review comments #
Messages
Total messages: 51 (37 generated)
Patchset #2 (id:20001) has been deleted
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
mohsen@chromium.org changed reviewers: + bruthig@chromium.org, tdanderson@chromium.org
tdanderson@, bruthig@: Please take a look...
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-device-gn on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device-gn/bui...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) ios-simulator-gn on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-gn/...) mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...)
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: 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-ge...) chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...) linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) win_chromium_compile_dbg_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_comp...) win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_...) win_clang on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_clang/builds/...)
https://codereview.chromium.org/2186363002/diff/40001/ash/test/ash_test_base.h File ash/test/ash_test_base.h (right): https://codereview.chromium.org/2186363002/diff/40001/ash/test/ash_test_base.... ash/test/ash_test_base.h:145: material_mode_ = material_mode; Can you add 'CHECK(setup_called_)' here?
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #4 (id:80001) has been deleted
Mohsen, thanks again for looking into this. The approach lgtm and I have left a few comments. I'd value Ben's input on this too. https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... File ash/shelf/shelf_view_unittest.cc (right): https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2119: class ShelfViewInkDropTest : public ShelfViewTest { Can you add a comment here saying that this fixture forces MD to be enabled for the test run (i.e., test fixture is only applicable with the MD feature work) https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2128: set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL); Just a thought (not necessarily something to address in this CL): if there are going to be lots of places where we will need to make calls like this, maybe we could change MaterialDesignController to look something like: Mode MDC::ModeForShelf() { return EXPERIMENTAL; // (*) } bool MDC::IsShelfMaterial() { return mode() == ModeForShelf(); } then line 2128 could be: set_material_mode(MDC::ModeForShelf()); The advantage is that when the MD shelf needs to change mode (e.g., if we promote from EXPERIMENTAL to NORMAL) then (*) would be the only line that needs to change. https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_base.h File ash/test/ash_test_base.h (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_base... ash/test/ash_test_base.h:144: void set_material_mode(MaterialDesignController::Mode material_mode) { optional nit: consider calling this set_material_mode_for_test() or similar to make it extra clear at call sites. If you do that, perhaps change |material_mode_| to |material_mode_for_test_|. https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... File ash/test/ash_test_helper.cc (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... ash/test/ash_test_helper.cc:129: // If |material_mode| is not set, use the value from command line switches. I think it would be better to have this documented in the .h above AshTestHelper::SetUp() instead of buried in the implementation. Maybe also explicitly call out the fact that if the |material_mode| parameter is something other than UNINITIALIZED, any command line value will be ignored. https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... File ash/test/ash_test_helper.h (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... ash/test/ash_test_helper.h:113: std::unique_ptr<test::MaterialDesignControllerTestAPI> material_design_state_; Can't this be owned by AshTestBase instead?
https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... File ash/shelf/shelf_view_unittest.cc (right): https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2119: class ShelfViewInkDropTest : public ShelfViewTest { On 2016/07/29 15:16:50, tdanderson wrote: > Can you add a comment here saying that this fixture forces MD to be enabled for > the test run (i.e., test fixture is only applicable with the MD feature work) Are there any tests here that are NON_MATERIAL specific, or should there be? i.e. Should we be running these tests with more than just the one material design mode? https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2128: set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL); On 2016/07/29 15:16:50, tdanderson wrote: > Just a thought (not necessarily something to address in this CL): if there are > going to be lots of places where we will need to make calls like this, maybe we > could change MaterialDesignController to look something like: > > Mode MDC::ModeForShelf() { > return EXPERIMENTAL; // (*) > } > > bool MDC::IsShelfMaterial() { > return mode() == ModeForShelf(); > } > > then line 2128 could be: > > set_material_mode(MDC::ModeForShelf()); > > The advantage is that when the MD shelf needs to change mode (e.g., if we > promote from EXPERIMENTAL to NORMAL) then (*) would be the only line that needs > to change. +1 to something like this. Could "ModeForShelf()" be replaced with a constant? https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... File ash/test/ash_test_helper.h (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... ash/test/ash_test_helper.h:113: std::unique_ptr<test::MaterialDesignControllerTestAPI> material_design_state_; On 2016/07/29 15:16:50, tdanderson wrote: > Can't this be owned by AshTestBase instead? The TestAPI Needs to be initialized after the MaterialDesignController, (or instead of) which is currently done on line 128 in the ash_test_helper.cc and before the Shell instance is constructed. So if we are to move the TestAPI we will also have to move this initialization. I am not sure what the original considerations were for the initializing the controller in the helper...
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #6 (id:140001) has been deleted
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... File ash/shelf/shelf_view_unittest.cc (right): https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2119: class ShelfViewInkDropTest : public ShelfViewTest { On 2016/07/29 at 15:16:50, tdanderson wrote: > Can you add a comment here saying that this fixture forces MD to be enabled for the test run (i.e., test fixture is only applicable with the MD feature work) Done. https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2119: class ShelfViewInkDropTest : public ShelfViewTest { On 2016/07/29 16:13:03, bruthig wrote: > On 2016/07/29 15:16:50, tdanderson wrote: > > Can you add a comment here saying that this fixture forces MD to be enabled > for > > the test run (i.e., test fixture is only applicable with the MD feature work) > > Are there any tests here that are NON_MATERIAL specific, or should there be? > i.e. Should we be running these tests with more than just the one material > design mode? No, these are all ripple tests and only make sense in material mode. https://codereview.chromium.org/2186363002/diff/100001/ash/shelf/shelf_view_u... ash/shelf/shelf_view_unittest.cc:2128: set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL); On 2016/07/29 16:13:04, bruthig wrote: > On 2016/07/29 15:16:50, tdanderson wrote: > > Just a thought (not necessarily something to address in this CL): if there are > > going to be lots of places where we will need to make calls like this, maybe > we > > could change MaterialDesignController to look something like: > > > > Mode MDC::ModeForShelf() { > > return EXPERIMENTAL; // (*) > > } > > > > bool MDC::IsShelfMaterial() { > > return mode() == ModeForShelf(); > > } > > > > then line 2128 could be: > > > > set_material_mode(MDC::ModeForShelf()); > > > > The advantage is that when the MD shelf needs to change mode (e.g., if we > > promote from EXPERIMENTAL to NORMAL) then (*) would be the only line that > needs > > to change. > > +1 to something like this. Could "ModeForShelf()" be replaced with a constant? As discussed in person, this is not simple since EXPERIMENTAL also implies NORMAL. For example, when shelf is promoted to NORMAL, then IsShelfMaterial() should return true not just for NORMAL but also for EXPERIMENTAL. Maybe we need to add some sort of ordering between modes. Anyways, better to address in anotehr CL. https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_base.h File ash/test/ash_test_base.h (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_base... ash/test/ash_test_base.h:144: void set_material_mode(MaterialDesignController::Mode material_mode) { On 2016/07/29 at 15:16:50, tdanderson wrote: > optional nit: consider calling this set_material_mode_for_test() or similar to make it extra clear at call sites. If you do that, perhaps change |material_mode_| to |material_mode_for_test_|. This whole class is for testing purposes. What would be the point of adding for_test suffix to this one? https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... File ash/test/ash_test_helper.cc (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... ash/test/ash_test_helper.cc:129: // If |material_mode| is not set, use the value from command line switches. On 2016/07/29 at 15:16:50, tdanderson wrote: > I think it would be better to have this documented in the .h above AshTestHelper::SetUp() instead of buried in the implementation. Maybe also explicitly call out the fact that if the |material_mode| parameter is something other than UNINITIALIZED, any command line value will be ignored. Right. Done. https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... File ash/test/ash_test_helper.h (right): https://codereview.chromium.org/2186363002/diff/100001/ash/test/ash_test_help... ash/test/ash_test_helper.h:113: std::unique_ptr<test::MaterialDesignControllerTestAPI> material_design_state_; On 2016/07/29 16:13:04, bruthig wrote: > On 2016/07/29 15:16:50, tdanderson wrote: > > Can't this be owned by AshTestBase instead? > > The TestAPI Needs to be initialized after the MaterialDesignController, (or > instead of) which is currently done on line 128 in the ash_test_helper.cc and > before the Shell instance is constructed. So if we are to move the TestAPI we > will also have to move this initialization. I am not sure what the original > considerations were for the initializing the controller in the helper... I believe these initializations are in AshTestHelper rather than AshTestBase so that they can be used in other tests that need to initialize Ash (e.g. BrowserWithTestWindowTest).
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm with nit https://codereview.chromium.org/2186363002/diff/160001/ash/test/ash_test_base.h File ash/test/ash_test_base.h (right): https://codereview.chromium.org/2186363002/diff/160001/ash/test/ash_test_base... ash/test/ash_test_base.h:145: material_mode_ = material_mode; (In case this got lost) Can you add 'CHECK(!setup_called_)' here?
mohsen@chromium.org changed reviewers: + oshima@chromium.org
oshima@: Can you take a look, please? https://codereview.chromium.org/2186363002/diff/160001/ash/test/ash_test_base.h File ash/test/ash_test_base.h (right): https://codereview.chromium.org/2186363002/diff/160001/ash/test/ash_test_base... ash/test/ash_test_base.h:145: material_mode_ = material_mode; On 2016/07/29 at 19:53:25, bruthig wrote: > (In case this got lost) > > Can you add 'CHECK(!setup_called_)' here? Oops! Done.
lgtm
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
mohsen@chromium.org changed reviewers: + thestig@chromium.org
thestig@: Can you please take an OWNERS look at chrome/test/base/browser_with_test_window_test.cc?
lgtm if you IWYU. Also please note chrome/test/OWNERS exists. https://codereview.chromium.org/2186363002/diff/180001/chrome/test/base/brows... File chrome/test/base/browser_with_test_window_test.cc (right): https://codereview.chromium.org/2186363002/diff/180001/chrome/test/base/brows... chrome/test/base/browser_with_test_window_test.cc:59: ash::MaterialDesignController::Mode::UNINITIALIZED); Please IWYU and #include ash/common/material_design/material_design_controller.h above in the right place.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by mohsen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Yeah, sorry! I noticed chrome/test/OWNERS, but they were OOO and I wanted to get the CL reviewed before the weekend to unblock some other changes. Thanks for the review! https://codereview.chromium.org/2186363002/diff/180001/chrome/test/base/brows... File chrome/test/base/browser_with_test_window_test.cc (right): https://codereview.chromium.org/2186363002/diff/180001/chrome/test/base/brows... chrome/test/base/browser_with_test_window_test.cc:59: ash::MaterialDesignController::Mode::UNINITIALIZED); On 2016/07/29 at 20:43:57, Lei Zhang wrote: > Please IWYU and #include ash/common/material_design/material_design_controller.h above in the right place. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by mohsen@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from tdanderson@chromium.org, bruthig@chromium.org, thestig@chromium.org, oshima@chromium.org Link to the patchset: https://codereview.chromium.org/2186363002/#ps200001 (title: "Addressed review comments")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #8 (id:200001)
Message was sent while issue was closed.
Description was changed from ========== Set Ash material design mode in tests properly Currently, in Ash tests, material design mode is set after call to AshTestBase::SetUp(). This is not right as some setup in AshTestBase might depend on material mode. This CL allows setting material mode before calling AshTestBase::SetUp(). BUG=620093 ========== to ========== Set Ash material design mode in tests properly Currently, in Ash tests, material design mode is set after call to AshTestBase::SetUp(). This is not right as some setup in AshTestBase might depend on material mode. This CL allows setting material mode before calling AshTestBase::SetUp(). BUG=620093 Committed: https://crrev.com/c66d687b9ffbd366ff3a1ca85acb6c0c4eab1ab1 Cr-Commit-Position: refs/heads/master@{#408837} ==========
Message was sent while issue was closed.
Patchset 8 (id:??) landed as https://crrev.com/c66d687b9ffbd366ff3a1ca85acb6c0c4eab1ab1 Cr-Commit-Position: refs/heads/master@{#408837} |