Commit b53d1f99 authored by Katie D's avatar Katie D Committed by Commit Bot

Clean-up: Improves test coverage of AccessibilityDetailedView.

Adds tests for docked magnifier, dictation, switch access, and some more
for select-to-speak.

Adds coverage for lines which change checked state of the
HoverHighlightViews, and also checks checked state as well as
the bool for tests. Total line coverage increase from 64% to 96%
in tray_accessibility.cc.

Some clean-up to reduce common lines in helper functions within
the test.

Bug: 1067399
Relnotes: N/A
Change-Id: I05ae85ac043c9fa71e0813a1f0948d990d82afbf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2135022
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757068}
parent 91ac7d23
......@@ -69,6 +69,8 @@ namespace tray {
////////////////////////////////////////////////////////////////////////////////
// ash::tray::AccessibilityDetailedView
constexpr char AccessibilityDetailedView::kClassName[];
AccessibilityDetailedView::AccessibilityDetailedView(
DetailedViewDelegate* delegate)
: TrayDetailedView(delegate) {
......@@ -184,7 +186,7 @@ void AccessibilityDetailedView::OnAccessibilityStatusChanged() {
}
const char* AccessibilityDetailedView::GetClassName() const {
return "AccessibilityDetailedView";
return kClassName;
}
void AccessibilityDetailedView::AppendAccessibilityList() {
......
......@@ -37,6 +37,8 @@ namespace tray {
// Create the detailed view of accessibility tray.
class ASH_EXPORT AccessibilityDetailedView : public TrayDetailedView {
public:
static constexpr char kClassName[] = "AccessibilityDetailedView";
explicit AccessibilityDetailedView(DetailedViewDelegate* delegate);
~AccessibilityDetailedView() override {}
......
......@@ -7,6 +7,7 @@
#include <memory>
#include "ash/system/accessibility/tray_accessibility.h"
#include "ash/system/tray/actionable_view.h"
#include "ash/system/tray/tray_popup_item_style.h"
#include "base/bind.h"
......@@ -98,6 +99,8 @@ class HoverHighlightView : public ActionableView {
TriView* tri_view() { return tri_view_; }
private:
friend class TrayAccessibilityTest;
// Adds the image and label to the row with the label being styled using
// |font_style|.
void DoAddIconAndLabel(const gfx::ImageSkia& image,
......
......@@ -473,11 +473,13 @@ void TrayDetailedView::TransitionToMainView() {
}
void TrayDetailedView::CloseBubble() {
// Don't close again if we're already closing.
// widget may be null in tests, in this case we do not need to do anything.
views::Widget* widget = GetWidget();
if (widget && widget->IsClosed())
if (!widget)
return;
// Don't close again if we're already closing.
if (widget->IsClosed())
return;
delegate_->CloseBubble();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment