New issue
Advanced search Search tips

Issue 656871 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

MaterialDesignController::Initialize leaks state between tests run in the same process

Project Member Reported by tapted@chromium.org, Oct 18 2016

Issue description

Chrome Version       : 55.0.2883.11

What steps will reproduce the problem?
1. Remove calls to ui::test::MaterialDesignControllerTestAPI::Uninitialize(); in *::SetUp()* overrides [note: not TearDown()] in views_test_base.cc, browser_test_base.cc, etc.
2. Run tests (e.g. views_unittests)

What is the expected result?

No flakes

What happens instead of that?

For example,

[45919:1295:1018/134037:102677652065524:FATAL:material_design_controller.cc(47)] Check failed: !is_mode_initialized_.
base::debug::StackTrace::StackTrace() + 19
logging::LogMessage::~LogMessage() + 347
ui::MaterialDesignController::Initialize() + 425
views::test::BridgedNativeWidgetTest::SetUp() + 251
testing::Test::Run() + 464
testing::TestInfo::Run() + 1075
testing::TestCase::Run() + 1287
testing::internal::UnitTestImpl::RunAllTests() + 2311
testing::UnitTest::Run() + 413
base::TestSuite::Run() + 486
base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback<int (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&, int, int, bool, base::Callback<void (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) + 679
base::LaunchUnitTests(int, char**, base::Callback<int (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) + 404
views::ViewsTestSuite::RunTests() + 365
main + 196
start + 52


Added tracing - this was previously initialized in another test run in the same process, with the stack:

base::debug::StackTrace::StackTrace() + 19
ui::MaterialDesignController::Initialize() + 367
views::ViewsTestBase::SetUp() + 176
testing::Test::Run() + 464
testing::TestInfo::Run() + 1075
testing::TestCase::Run() + 1287
testing::internal::UnitTestImpl::RunAllTests() + 2311
testing::UnitTest::Run() + 413
base::TestSuite::Run() + 486
base::(anonymous namespace)::LaunchUnitTestsInternal(base::Callback<int (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&, int, int, bool, base::Callback<void (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) + 679
base::LaunchUnitTests(int, char**, base::Callback<int (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) + 404
views::ViewsTestSuite::RunTests() + 365
main + 196
start + 52


views::test::BridgedNativeWidgetTest::SetUp() doesn't call views::ViewsTestBase::SetUp() (because BridgedNativeWidgetTest does not inherit from ViewsTestBase). So some other test initialized MD, but didn't uninitialize it.

The test doesn't CHECK() on a retry because the test that used the ViewsTestBase harness isn't run.



The problem is in ViewsTestBase -- it doesn't balance the call to Initialize in TearDown(). But neither does ContentTestSuiteBase.

The resolution for this began in r387186 which is just to call `ui::test::MaterialDesignControllerTestAPI::Uninitialize();` before any call to `ui::MaterialDesignController::Initialize();` in a test. But that doesn't address the root cause.
 

Comment 1 by varkha@chromium.org, Oct 18 2016

Cc: tdander...@chromium.org bruthig@chromium.org pkasting@chromium.org moh...@chromium.org est...@chromium.org
Thanks, that's a good analysis and it matches the challenges here. MDC will be going away soon so I think the right thing to do here is to just rip it out since it has been enabled by default for a while now.

Comment 2 by varkha@chromium.org, Oct 18 2016

IsSecondaryUiMaterial is having more use now and will probably need to stay for longer.

Comment 3 by varkha@chromium.org, Oct 23 2017

Cc: -bruthig@chromium.org -tdander...@chromium.org
Owner: ----
Status: WontFix (was: Assigned)

Sign in to add a comment