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

Issue 1778643002: Moved AppMenu ACTIVATED/DEACTIVATED ink drop handling in to MenuButton. (Closed)

Created:
4 years, 9 months ago by bruthig
Modified:
4 years, 9 months ago
Reviewers:
varkha, sky, Evan Stade
CC:
chromium-reviews, tfarina, varkha
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Moved AppMenu ACTIVATED/DEACTIVATED ink drop handling in to MenuButton. The AppMenuButton and the ToolbarActionView buttons were both handling the ink drop animating to/from the ACTIVATED/DEACTIVATED states. This change pushes that logic up in the common ancestor MenuButton. BUG=592058 TEST=MenuButtonTest.* TEST=ToolbarActionViewUnitTest.NoCrashWhenDestroyingToolbarActionViewThatHasAPressedLock Committed: https://crrev.com/3ead9e2c8b5d650d7d72868ab10f147a86642b97 Cr-Commit-Position: refs/heads/master@{#380626}

Patch Set 1 #

Total comments: 6

Patch Set 2 : Added tests and addressed comments. #

Total comments: 3

Patch Set 3 : Added TestInkDropDelegate. #

Patch Set 4 : Merge with master. #

Patch Set 5 : Added explicit to PressStateMenuButtonListener ctor. #

Patch Set 6 : Removed extra ACTION_PENDING animation trigger from MenuButton::OnMousePressed(). #

Patch Set 7 : Fixed crash when destroying a ToolbarActionView. #

Patch Set 8 : Fixed bugs found on try-bots and added smaller scoped tests to find them. #

Patch Set 9 : Added a check for a null ThemeProvider in ToolbarActionView::GetInkDropBaseColor(). #

Patch Set 10 : Attempted to fix MenuButtonTest.InkDropStateForMenuButtonActivationsWithListenerThatDontReleaseAllL… #

Patch Set 11 : fixed compile time typo #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+325 lines, -43 lines) Patch
M chrome/browser/ui/views/toolbar/app_menu_button.h View 1 2 3 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/ui/views/toolbar/app_menu_button.cc View 1 2 3 4 chunks +1 line, -20 lines 0 comments Download
M chrome/browser/ui/views/toolbar/toolbar_action_view.cc View 1 2 3 4 5 6 7 8 5 chunks +8 lines, -5 lines 1 comment Download
M chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc View 1 2 3 4 5 6 7 2 chunks +60 lines, -1 line 0 comments Download
A ui/views/animation/test/test_ink_drop_delegate.h View 1 2 1 chunk +38 lines, -0 lines 0 comments Download
A ui/views/animation/test/test_ink_drop_delegate.cc View 1 2 1 chunk +24 lines, -0 lines 0 comments Download
M ui/views/controls/button/menu_button.h View 1 chunk +3 lines, -0 lines 0 comments Download
M ui/views/controls/button/menu_button.cc View 1 2 3 4 5 6 7 6 chunks +26 lines, -9 lines 0 comments Download
M ui/views/controls/button/menu_button_unittest.cc View 1 2 3 4 5 6 7 8 9 10 9 chunks +163 lines, -5 lines 0 comments Download
M ui/views/views.gyp View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (9 generated)
bruthig
sky@, can you please have a look?
4 years, 9 months ago (2016-03-08 20:36:15 UTC) #2
varkha
https://codereview.chromium.org/1778643002/diff/1/ui/views/controls/button/menu_button.cc File ui/views/controls/button/menu_button.cc (right): https://codereview.chromium.org/1778643002/diff/1/ui/views/controls/button/menu_button.cc#newcode373 ui/views/controls/button/menu_button.cc:373: const ButtonState previous_state = state(); Could you not call ...
4 years, 9 months ago (2016-03-08 21:47:58 UTC) #4
sky
This is fine by me. How about test coverage?
4 years, 9 months ago (2016-03-08 23:01:57 UTC) #5
bruthig
I've addressed comments and added tests. sky@, varkha@, PTAL https://codereview.chromium.org/1778643002/diff/1/ui/views/controls/button/menu_button.cc File ui/views/controls/button/menu_button.cc (right): https://codereview.chromium.org/1778643002/diff/1/ui/views/controls/button/menu_button.cc#newcode373 ui/views/controls/button/menu_button.cc:373: ...
4 years, 9 months ago (2016-03-09 01:52:57 UTC) #7
sky
https://codereview.chromium.org/1778643002/diff/20001/ui/views/controls/button/menu_button_unittest.cc File ui/views/controls/button/menu_button_unittest.cc (right): https://codereview.chromium.org/1778643002/diff/20001/ui/views/controls/button/menu_button_unittest.cc#newcode169 ui/views/controls/button/menu_button_unittest.cc:169: PressStateMenuButtonListener(bool release_lock) explicit https://codereview.chromium.org/1778643002/diff/20001/ui/views/views.gyp File ui/views/views.gyp (right): https://codereview.chromium.org/1778643002/diff/20001/ui/views/views.gyp#newcode497 ui/views/views.gyp:497: ...
4 years, 9 months ago (2016-03-09 16:21:38 UTC) #8
bruthig
On 2016/03/09 16:21:38, sky wrote: > https://codereview.chromium.org/1778643002/diff/20001/ui/views/controls/button/menu_button_unittest.cc > File ui/views/controls/button/menu_button_unittest.cc (right): > > https://codereview.chromium.org/1778643002/diff/20001/ui/views/controls/button/menu_button_unittest.cc#newcode169 > ...
4 years, 9 months ago (2016-03-09 16:24:16 UTC) #9
sky
LGTM
4 years, 9 months ago (2016-03-09 16:35:57 UTC) #10
bruthig
sky@, I know you already lgtm'd this but I had to add fix some failing ...
4 years, 9 months ago (2016-03-11 01:09:50 UTC) #12
bruthig
(Actually adding estade@ this time...) FYI estade@, it appears that the ToolbarActionView's don't always have ...
4 years, 9 months ago (2016-03-11 01:11:29 UTC) #14
sky
SLGTM
4 years, 9 months ago (2016-03-11 05:09:25 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1778643002/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1778643002/200001
4 years, 9 months ago (2016-03-11 13:14:36 UTC) #18
commit-bot: I haz the power
Committed patchset #11 (id:200001)
4 years, 9 months ago (2016-03-11 14:20:59 UTC) #20
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/3ead9e2c8b5d650d7d72868ab10f147a86642b97 Cr-Commit-Position: refs/heads/master@{#380626}
4 years, 9 months ago (2016-03-11 14:22:35 UTC) #22
Evan Stade
https://codereview.chromium.org/1778643002/diff/200001/chrome/browser/ui/views/toolbar/toolbar_action_view.cc File chrome/browser/ui/views/toolbar/toolbar_action_view.cc (right): https://codereview.chromium.org/1778643002/diff/200001/chrome/browser/ui/views/toolbar/toolbar_action_view.cc#newcode122 chrome/browser/ui/views/toolbar/toolbar_action_view.cc:122: return GetThemeProvider() this doesn't seem right to me. I ...
4 years, 9 months ago (2016-03-14 21:20:43 UTC) #23
bruthig
On 2016/03/14 21:20:43, Evan Stade wrote: > https://codereview.chromium.org/1778643002/diff/200001/chrome/browser/ui/views/toolbar/toolbar_action_view.cc > File chrome/browser/ui/views/toolbar/toolbar_action_view.cc (right): > > https://codereview.chromium.org/1778643002/diff/200001/chrome/browser/ui/views/toolbar/toolbar_action_view.cc#newcode122 ...
4 years, 9 months ago (2016-03-15 15:42:01 UTC) #24
Evan Stade
On 2016/03/15 15:42:01, bruthig wrote: > On 2016/03/14 21:20:43, Evan Stade wrote: > > > ...
4 years, 9 months ago (2016-03-15 19:30:58 UTC) #25
bruthig
On 2016/03/15 19:30:58, Evan Stade wrote: > On 2016/03/15 15:42:01, bruthig wrote: > > On ...
4 years, 9 months ago (2016-03-17 15:47:32 UTC) #26
sky
I wouldn't expect a browsertest to create an environment that doesn't match production. What is ...
4 years, 9 months ago (2016-03-17 21:07:04 UTC) #27
Evan Stade
I'm pretty sure it is in a widget, it's just not yet in a widget ...
4 years, 9 months ago (2016-03-17 21:09:37 UTC) #28
sky
4 years, 9 months ago (2016-03-17 23:29:55 UTC) #29
Message was sent while issue was closed.
Never mind my question here. I saw the patch which explains how the
button wasn't in a widget.

  -Scott

On Thu, Mar 17, 2016 at 2:07 PM, Scott Violet <sky@chromium.org> wrote:
> I wouldn't expect a browsertest to create an environment that doesn't
> match production. What is
> MediaRouterUIBrowserTest.OpenDialogWithMediaRouterAction doing that
> the button is not in a widget?
>
>   -Scott
>
> On Thu, Mar 17, 2016 at 8:47 AM,  <bruthig@chromium.org> wrote:
>> On 2016/03/15 19:30:58, Evan Stade wrote:
>>> On 2016/03/15 15:42:01, bruthig wrote:
>>> > On 2016/03/14 21:20:43, Evan Stade wrote:
>>> > >
>>> >
>>>
>>
https://codereview.chromium.org/1778643002/diff/200001/chrome/browser/ui/view...
>>> > > File chrome/browser/ui/views/toolbar/toolbar_action_view.cc (right):
>>> > >
>>> > >
>>> >
>>>
>>
https://codereview.chromium.org/1778643002/diff/200001/chrome/browser/ui/view...
>>> > > chrome/browser/ui/views/toolbar/toolbar_action_view.cc:122: return
>>> > > GetThemeProvider()
>>> > > this doesn't seem right to me. I think your change is causing
>>> > > GetInkDropBaseColor to be called before |this| is added to a widget,
>>> > > which
>>> we
>>> > > probably don't need/want. What was the callstack?
>>> >
>>> > Here's the stack trace, you can repro by adding a
>> DCHECK(GetThemeProvider());
>>> in
>>> > ToolbarActionView::GetInkDropBaseColor() and running
>> 'out/Debug/browser_tests
>>> >
>>> >
--gtest_filter=*MediaRouterUIBrowserTest.OpenDialogWithMediaRouterAction*'
>>> >
>>> >
>>> > #0 0x000000907a11 __interceptor_backtrace
>>> > #1 0x7efe72b585ce base::debug::StackTrace::StackTrace()
>>> > #2 0x7efe72c813ff logging::LogMessage::~LogMessage()
>>> > #3 0x0000072a1555 ToolbarActionView::GetInkDropBaseColor()
>>> > #4 0x7efe4f3fe7f6 views::InkDropHostView::CreateInkDropAnimation()
>>> > #5 0x7efe4f458042 views::LabelButton::CreateInkDropAnimation()
>>> > #6 0x7efe4f4587b3 views::LabelButton::CreateInkDropAnimation()
>>> > #7 0x7efe4f3f8720
>>> > views::InkDropAnimationControllerImpl::CreateInkDropAnimation()
>>> > #8 0x7efe4f3f83f9
>>> > views::InkDropAnimationControllerImpl::AnimateToState()
>>> > #9 0x7efe4f3f060b views::ButtonInkDropDelegate::OnAction()
>>> > #10 0x7efe4f460499 views::MenuButton::IncrementPressedLocked()
>>> > #11 0x7efe4f4601ea views::MenuButton::PressedLock::PressedLock()
>>> > #12 0x7efe4f46017f views::MenuButton::PressedLock::PressedLock()
>>> > #13 0x0000072a3534 ToolbarActionView::OnPopupShown()
>>> > #14 0x00000754e781 MediaRouterAction::OnPopupShown()
>>> > #15 0x000007558add
>>> > media_router::MediaRouterDialogControllerImpl::CreateMediaRouterDialog()
>>> > #16 0x00000d283d76
>>> > media_router::MediaRouterDialogController::ShowMediaRouterDialog()
>>> > #17 0x00000754d3ea MediaRouterAction::ExecuteAction()
>>> > #18 0x0000033bca4c
>>> > media_router::MediaRouterUIBrowserTest::ExecuteMediaRouterAction()
>>> > #19 0x0000033bda5b
>>> >
>>>
>>
_ZN4base8internal15RunnableAdapterIMN12media_router24MediaRouterUIBrowserTestEFvP13AppMenuButtonEE3RunIJRKS5_EEEvPS3_DpOT_
>>> > #20 0x0000033bd89f
>>> >
>>>
>>
_ZN4base8internal12InvokeHelperILb0EvNS0_15RunnableAdapterIMN12media_router24MediaRouterUIBrowserTestEFvP13AppMenuButtonEEEE8MakeItSoIJPS4_RKS6_EEEvS9_DpOT_
>>> > #21 0x0000033bd670
>>> >
>>>
>>
_ZN4base8internal7InvokerINS_13IndexSequenceIJLm0ELm1EEEENS0_9BindStateINS0_15RunnableAdapterIMN12media_router24MediaRouterUIBrowserTestEFvP13AppMenuButtonEEEFvPS7_S9_EJSD_RS9_EEENS0_12InvokeHelperILb0EvSC_EEFvvEE3RunEPNS0_13BindStateBaseE
>>> > #22 0x7efe72afb8b4 base::Callback<>::Run()
>>> > #23 0x7efe72b66ae1 base::debug::TaskAnnotator::RunTask()
>>> > #24 0x7efe72cd6552 base::MessageLoop::RunTask()
>>> > #25 0x7efe72cd6e0a base::MessageLoop::DeferOrRunPendingTask()
>>> > #26 0x7efe72cd7f78 base::MessageLoop::DoWork()
>>> > #27 0x7efe72a95764 base::MessagePumpGlib::Run()
>>> > #28 0x7efe72cd52d9 base::MessageLoop::RunHandler()
>>> > #29 0x7efe72e2104c base::RunLoop::Run()
>>> > #30 0x7efe4f783ee1 views::MenuMessageLoopAura::Run()
>>> > #31 0x7efe4f4a0c90 views::MenuController::RunMessageLoop()
>>> > #32 0x7efe4f49eb92 views::MenuController::Run()
>>> > #33 0x7efe4f506000 views::internal::MenuRunnerImpl::RunMenuAt()
>>> > #34 0x7efe4f50413e views::MenuRunner::RunMenuAt()
>>> > #35 0x000007eef9a1 AppMenu::RunMenu()
>>> > #36 0x0000072640a1 AppMenuButton::ShowMenu()
>>> > #37 0x0000033b9fe5
>>> >
>>>
>>
media_router::MediaRouterUIBrowserTest::OpenMediaRouterDialogAndWaitForNewWebContents()
>>> > #38 0x0000033b983d
>>> >
>>>
>>
media_router::MediaRouterUIBrowserTest_OpenDialogWithMediaRouterAction_Test::RunTestOnMainThread()
>>> > #39 0x00000653b783 InProcessBrowserTest::RunTestOnMainThreadLoop()
>>> > #40 0x00000668b304
>>> > content::BrowserTestBase::ProxyRunTestOnMainThreadLoop()
>>> > #41 0x00000668f20b
>>> >
>>>
>>
_ZN4base8internal15RunnableAdapterIMN7content15BrowserTestBaseEFvvEE3RunIJEEEvPS3_DpOT_
>>> > #42 0x00000668f09d
>>> >
>>>
>>
_ZN4base8internal12InvokeHelperILb0EvNS0_15RunnableAdapterIMN7content15BrowserTestBaseEFvvEEEE8MakeItSoIJPS4_EEEvS7_DpOT_
>>> > #43 0x00000668eea9
>>> >
>>>
>>
_ZN4base8internal7InvokerINS_13IndexSequenceIJLm0EEEENS0_9BindStateINS0_15RunnableAdapterIMN7content15BrowserTestBaseEFvvEEEFvPS7_EJSB_EEENS0_12InvokeHelperILb0EvSA_EEFvvEE3RunEPNS0_13BindStateBaseE
>>> > #44 0x000000aff044 base::Callback<>::Run()
>>> > #45 0x0000058e1147 ChromeBrowserMainParts::PreMainMessageLoopRunImpl()
>>> > #46 0x0000058dc82f ChromeBrowserMainParts::PreMainMessageLoopRun()
>>> > #47 0x7efe6334c2ac content::BrowserMainLoop::PreMainMessageLoopRun()
>>> > #48 0x7efe6335f28b
>>> >
>>>
>>
_ZN4base8internal15RunnableAdapterIMN7content15BrowserMainLoopEFivEE3RunIJEEEiPS3_DpOT_
>>> > #49 0x7efe6335efcd
>>> >
>>>
>>
_ZN4base8internal12InvokeHelperILb0EiNS0_15RunnableAdapterIMN7content15BrowserMainLoopEFivEEEE8MakeItSoIJPS4_EEEiS7_DpOT_
>>> > #50 0x7efe6335edc1
>>> >
>>>
>>
_ZN4base8internal7InvokerINS_13IndexSequenceIJLm0EEEENS0_9BindStateINS0_15RunnableAdapterIMN7content15BrowserMainLoopEFivEEEFiPS7_EJNS0_17UnretainedWrapperIS7_EEEEENS0_12InvokeHelperILb0EiSA_EEFivEE3RunEPNS0_13BindStateBaseE
>>> > #51 0x7efe646cf5d4 base::Callback<>::Run()
>>> > #52 0x7efe654b3b87 content::StartupTaskRunner::RunAllTasksNow()
>>> > #53 0x7efe63344fe2 content::BrowserMainLoop::CreateStartupTasks()
>>> > #54 0x7efe633646c2 content::BrowserMainRunnerImpl::Initialize()
>>> > #55 0x7efe633323aa content::BrowserMain()
>>> > #56 0x7efe62cdb6bf content::RunNamedProcessTypeMain()
>>> > #57 0x7efe62ce3352 content::ContentMainRunnerImpl::Run()
>>> > #58 0x7efe62cd9d95 content::ContentMain()
>>> > #59 0x00000668ab47 content::BrowserTestBase::SetUp()
>>> > #60 0x000006535625 InProcessBrowserTest::SetUp()
>>> > #61 0x000006b6623c
>>> testing::internal::HandleSehExceptionsInMethodIfSupported<>()
>>>
>>> yea, I think you need to change ToolbarActionView to not do this
>>>
>>> view_controller_->SetDelegate(this);
>>>
>>> or this
>>>
>>> UpdateState();
>>>
>>> in the ctor. Instead, move that to ViewHierarchyChanged (see many other
>>> places
>>> like
>>>
>>
https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/...
>>> )
>>
>> If you parse through what is happening in the
>> MediaRouterUIBrowserTest.OpenDialogWithMediaRouterAction test you will find
>> that
>> it is indeed attempting to use a ToolbarActionView that is not hosted within
>> a
>> Widget. So I guess fundamentally I am questioning why are we ok with
>> assuming a
>> Widget is hosting the ToolbarActionView when GetInkDropBaseColor() is
>> called?
>> Although this assumption may always be true in production, it would be a lot
>> easier to test the interaction of the ToolbarActionView together with the
>> InkDrop(Hover|Animation) classes without requiring the overhead of a Widget
>> to
>> host them. Let me be clear here, my concern is more about about how the
>> ThemeProviders are found and and used and it is obviously a much larger
>> discussion than these one or two InkDrop related cases. I'm only calling
>> attention to it here as a concrete example, for discussions sake, as to how
>> these implicit dependencies cause tests to include more than they really
>> should
>> be.
>>
>> sky@, estade@, What are your thoughts on this?
>>
>> FYI I have posted a better fix here:
>> https://codereview.chromium.org/1805393002/
>>
>> https://codereview.chromium.org/1778643002/

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698