Commit eb9fe15e authored by jiayl@chromium.org's avatar jiayl@chromium.org

Add unit tests for DesktopMediaPickerViews.

iBUG=308426

Review URL: https://codereview.chromium.org/393653004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283717 0039d316-1c4b-4281-b951-d872f2087c98
parent 9ca51ef7
......@@ -21,7 +21,7 @@ void FakeDesktopMediaList::AddSource(int id) {
void FakeDesktopMediaList::RemoveSource(int index) {
sources_.erase(sources_.begin() + index);
observer_->OnSourceRemoved(sources_.size() - 1);
observer_->OnSourceRemoved(index);
}
void FakeDesktopMediaList::MoveSource(int old_index, int new_index) {
......
......@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/media/desktop_media_picker.h"
#include "chrome/browser/ui/views/desktop_media_picker_views.h"
#include "base/callback.h"
#include "chrome/browser/media/desktop_media_list.h"
#include "chrome/browser/media/desktop_media_list_observer.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "components/web_modal/popup_manager.h"
......@@ -23,11 +22,9 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_client_view.h"
#include "ui/views/window/dialog_delegate.h"
#include "ui/wm/core/shadow_types.h"
using content::DesktopMediaID;
......@@ -49,12 +46,12 @@ const int kDesktopMediaSourceViewGroupId = 1;
const char kDesktopMediaSourceViewClassName[] =
"DesktopMediaPicker_DesktopMediaSourceView";
content::DesktopMediaID::Id AcceleratedWidgetToDesktopMediaId(
DesktopMediaID::Id AcceleratedWidgetToDesktopMediaId(
gfx::AcceleratedWidget accelerated_widget) {
#if defined(OS_WIN)
return reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget);
return reinterpret_cast<DesktopMediaID::Id>(accelerated_widget);
#else
return static_cast<content::DesktopMediaID::Id>(accelerated_widget);
return static_cast<DesktopMediaID::Id>(accelerated_widget);
#endif
}
......@@ -62,169 +59,7 @@ int GetMediaListViewHeightForRows(size_t rows) {
return kListItemHeight * rows;
}
class DesktopMediaListView;
class DesktopMediaPickerDialogView;
class DesktopMediaPickerViews;
// View used for each item in DesktopMediaListView. Shows a single desktop media
// source as a thumbnail with the title under it.
class DesktopMediaSourceView : public views::View {
public:
DesktopMediaSourceView(DesktopMediaListView* parent,
DesktopMediaID source_id);
virtual ~DesktopMediaSourceView();
// Updates thumbnail and title from |source|.
void SetName(const base::string16& name);
void SetThumbnail(const gfx::ImageSkia& thumbnail);
// Id for the source shown by this View.
const DesktopMediaID& source_id() const {
return source_id_;
}
// Returns true if the source is selected.
bool is_selected() const { return selected_; }
// Updates selection state of the element. If |selected| is true then also
// calls SetSelected(false) for the source view that was selected before that
// (if any).
void SetSelected(bool selected);
// views::View interface.
virtual const char* GetClassName() const OVERRIDE;
virtual void Layout() OVERRIDE;
virtual views::View* GetSelectedViewForGroup(int group) OVERRIDE;
virtual bool IsGroupFocusTraversable() const OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
private:
DesktopMediaListView* parent_;
DesktopMediaID source_id_;
views::ImageView* image_view_;
views::Label* label_;
bool selected_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView);
};
// View that shows list of desktop media sources available from
// DesktopMediaList.
class DesktopMediaListView : public views::View,
public DesktopMediaListObserver {
public:
DesktopMediaListView(DesktopMediaPickerDialogView* parent,
scoped_ptr<DesktopMediaList> media_list);
virtual ~DesktopMediaListView();
void StartUpdating(content::DesktopMediaID::Id dialog_window_id);
// Called by DesktopMediaSourceView when selection has changed.
void OnSelectionChanged();
// Called by DesktopMediaSourceView when a source has been double-clicked.
void OnDoubleClick();
// Returns currently selected source.
DesktopMediaSourceView* GetSelection();
// views::View overrides.
virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual void Layout() OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
private:
// DesktopMediaList::Observer interface
virtual void OnSourceAdded(int index) OVERRIDE;
virtual void OnSourceRemoved(int index) OVERRIDE;
virtual void OnSourceMoved(int old_index, int new_index) OVERRIDE;
virtual void OnSourceNameChanged(int index) OVERRIDE;
virtual void OnSourceThumbnailChanged(int index) OVERRIDE;
DesktopMediaPickerDialogView* parent_;
scoped_ptr<DesktopMediaList> media_list_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaListView);
};
// Dialog view used for DesktopMediaPickerViews.
class DesktopMediaPickerDialogView : public views::DialogDelegateView {
public:
DesktopMediaPickerDialogView(content::WebContents* parent_web_contents,
gfx::NativeWindow context,
gfx::NativeWindow parent_window,
DesktopMediaPickerViews* parent,
const base::string16& app_name,
const base::string16& target_name,
scoped_ptr<DesktopMediaList> media_list);
virtual ~DesktopMediaPickerDialogView();
// Called by parent (DesktopMediaPickerViews) when it's destroyed.
void DetachParent();
// Called by DesktopMediaListView.
void OnSelectionChanged();
void OnDoubleClick();
// views::View overrides.
virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual void Layout() OVERRIDE;
// views::DialogDelegateView overrides.
virtual ui::ModalType GetModalType() const OVERRIDE;
virtual base::string16 GetWindowTitle() const OVERRIDE;
virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
virtual base::string16 GetDialogButtonLabel(
ui::DialogButton button) const OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual void DeleteDelegate() OVERRIDE;
void OnMediaListRowsChanged();
private:
DesktopMediaPickerViews* parent_;
base::string16 app_name_;
views::Label* label_;
views::ScrollView* scroll_view_;
DesktopMediaListView* list_view_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView);
};
// Implementation of DesktopMediaPicker for Views.
class DesktopMediaPickerViews : public DesktopMediaPicker {
public:
DesktopMediaPickerViews();
virtual ~DesktopMediaPickerViews();
void NotifyDialogResult(DesktopMediaID source);
// DesktopMediaPicker overrides.
virtual void Show(content::WebContents* web_contents,
gfx::NativeWindow context,
gfx::NativeWindow parent,
const base::string16& app_name,
const base::string16& target_name,
scoped_ptr<DesktopMediaList> media_list,
const DoneCallback& done_callback) OVERRIDE;
private:
DoneCallback callback_;
// The |dialog_| is owned by the corresponding views::Widget instance.
// When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed
// asynchronously by closing the widget.
DesktopMediaPickerDialogView* dialog_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews);
};
} // namespace
DesktopMediaSourceView::DesktopMediaSourceView(
DesktopMediaListView* parent,
......@@ -370,8 +205,7 @@ DesktopMediaListView::DesktopMediaListView(
DesktopMediaListView::~DesktopMediaListView() {}
void DesktopMediaListView::StartUpdating(
content::DesktopMediaID::Id dialog_window_id) {
void DesktopMediaListView::StartUpdating(DesktopMediaID::Id dialog_window_id) {
media_list_->SetViewDialogWindowId(dialog_window_id);
media_list_->StartUpdating(this);
}
......@@ -564,7 +398,7 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
// DesktopMediaList needs to know the ID of the picker window which
// matches the ID it gets from the OS. Depending on the OS and configuration
// we get this ID differently.
content::DesktopMediaID::Id dialog_window_id = 0;
DesktopMediaID::Id dialog_window_id = 0;
// If there is |parent_window| or |parent_web_contents|, the picker window
// is embedded in the parent and does not have its own native window id, so we
......@@ -572,8 +406,8 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView(
if (!parent_window && !parent_web_contents) {
#if defined(USE_ASH)
if (chrome::IsNativeWindowInAsh(widget->GetNativeWindow())) {
dialog_window_id = content::DesktopMediaID::RegisterAuraWindow(
widget->GetNativeWindow()).id;
dialog_window_id =
DesktopMediaID::RegisterAuraWindow(widget->GetNativeWindow()).id;
DCHECK_NE(dialog_window_id, 0);
}
#endif
......@@ -694,6 +528,14 @@ void DesktopMediaPickerDialogView::OnMediaListRowsChanged() {
GetWidget()->CenterWindow(gfx::Size(widget_bound.width(), new_height));
}
DesktopMediaSourceView*
DesktopMediaPickerDialogView::GetMediaSourceViewForTesting(int index) const {
if (list_view_->child_count() <= index)
return NULL;
return reinterpret_cast<DesktopMediaSourceView*>(list_view_->child_at(index));
}
DesktopMediaPickerViews::DesktopMediaPickerViews() : dialog_(NULL) {
}
......@@ -732,8 +574,6 @@ void DesktopMediaPickerViews::NotifyDialogResult(DesktopMediaID source) {
callback_.Reset();
}
} // namespace
// static
scoped_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() {
return scoped_ptr<DesktopMediaPicker>(new DesktopMediaPickerViews());
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_
#include "chrome/browser/media/desktop_media_list_observer.h"
#include "chrome/browser/media/desktop_media_picker.h"
#include "ui/views/window/dialog_delegate.h"
namespace views {
class ImageView;
class Label;
} // namespace views
class DesktopMediaPickerDialogView;
class DesktopMediaPickerViews;
class DesktopMediaSourceView;
// View that shows a list of desktop media sources available from
// DesktopMediaList.
class DesktopMediaListView : public views::View,
public DesktopMediaListObserver {
public:
DesktopMediaListView(DesktopMediaPickerDialogView* parent,
scoped_ptr<DesktopMediaList> media_list);
virtual ~DesktopMediaListView();
void StartUpdating(content::DesktopMediaID::Id dialog_window_id);
// Called by DesktopMediaSourceView when selection has changed.
void OnSelectionChanged();
// Called by DesktopMediaSourceView when a source has been double-clicked.
void OnDoubleClick();
// Returns currently selected source.
DesktopMediaSourceView* GetSelection();
// views::View overrides.
virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual void Layout() OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
private:
// DesktopMediaList::Observer interface
virtual void OnSourceAdded(int index) OVERRIDE;
virtual void OnSourceRemoved(int index) OVERRIDE;
virtual void OnSourceMoved(int old_index, int new_index) OVERRIDE;
virtual void OnSourceNameChanged(int index) OVERRIDE;
virtual void OnSourceThumbnailChanged(int index) OVERRIDE;
DesktopMediaPickerDialogView* parent_;
scoped_ptr<DesktopMediaList> media_list_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaListView);
};
// View used for each item in DesktopMediaListView. Shows a single desktop media
// source as a thumbnail with the title under it.
class DesktopMediaSourceView : public views::View {
public:
DesktopMediaSourceView(DesktopMediaListView* parent,
content::DesktopMediaID source_id);
virtual ~DesktopMediaSourceView();
// Updates thumbnail and title from |source|.
void SetName(const base::string16& name);
void SetThumbnail(const gfx::ImageSkia& thumbnail);
// Id for the source shown by this View.
const content::DesktopMediaID& source_id() const { return source_id_; }
// Returns true if the source is selected.
bool is_selected() const { return selected_; }
// views::View interface.
virtual const char* GetClassName() const OVERRIDE;
virtual void Layout() OVERRIDE;
virtual views::View* GetSelectedViewForGroup(int group) OVERRIDE;
virtual bool IsGroupFocusTraversable() const OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
private:
// Updates selection state of the element. If |selected| is true then also
// calls SetSelected(false) for the source view that was selected before that
// (if any).
void SetSelected(bool selected);
DesktopMediaListView* parent_;
content::DesktopMediaID source_id_;
views::ImageView* image_view_;
views::Label* label_;
bool selected_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaSourceView);
};
// Dialog view used for DesktopMediaPickerViews.
class DesktopMediaPickerDialogView : public views::DialogDelegateView {
public:
DesktopMediaPickerDialogView(content::WebContents* parent_web_contents,
gfx::NativeWindow context,
gfx::NativeWindow parent_window,
DesktopMediaPickerViews* parent,
const base::string16& app_name,
const base::string16& target_name,
scoped_ptr<DesktopMediaList> media_list);
virtual ~DesktopMediaPickerDialogView();
// Called by parent (DesktopMediaPickerViews) when it's destroyed.
void DetachParent();
// Called by DesktopMediaListView.
void OnSelectionChanged();
void OnDoubleClick();
// views::View overrides.
virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual void Layout() OVERRIDE;
// views::DialogDelegateView overrides.
virtual ui::ModalType GetModalType() const OVERRIDE;
virtual base::string16 GetWindowTitle() const OVERRIDE;
virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
virtual base::string16 GetDialogButtonLabel(
ui::DialogButton button) const OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual void DeleteDelegate() OVERRIDE;
void OnMediaListRowsChanged();
DesktopMediaSourceView* GetMediaSourceViewForTesting(int index) const;
private:
DesktopMediaPickerViews* parent_;
base::string16 app_name_;
views::Label* label_;
views::ScrollView* scroll_view_;
DesktopMediaListView* list_view_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerDialogView);
};
// Implementation of DesktopMediaPicker for Views.
class DesktopMediaPickerViews : public DesktopMediaPicker {
public:
DesktopMediaPickerViews();
virtual ~DesktopMediaPickerViews();
void NotifyDialogResult(content::DesktopMediaID source);
// DesktopMediaPicker overrides.
virtual void Show(content::WebContents* web_contents,
gfx::NativeWindow context,
gfx::NativeWindow parent,
const base::string16& app_name,
const base::string16& target_name,
scoped_ptr<DesktopMediaList> media_list,
const DoneCallback& done_callback) OVERRIDE;
DesktopMediaPickerDialogView* GetDialogViewForTesting() const {
return dialog_;
}
private:
DoneCallback callback_;
// The |dialog_| is owned by the corresponding views::Widget instance.
// When DesktopMediaPickerViews is destroyed the |dialog_| is destroyed
// asynchronously by closing the widget.
DesktopMediaPickerDialogView* dialog_;
DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerViews);
};
#endif // CHROME_BROWSER_UI_VIEWS_DESKTOP_MEDIA_PICKER_VIEWS_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/bind.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/media/fake_desktop_media_list.h"
#include "chrome/browser/ui/views/desktop_media_picker_views.h"
#include "components/web_modal/test_web_contents_modal_dialog_host.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/views/test/views_test_helper.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
namespace views {
class DesktopMediaPickerViewsTest : public testing::Test {
public:
DesktopMediaPickerViewsTest() {}
virtual ~DesktopMediaPickerViewsTest() {}
virtual void SetUp() OVERRIDE {
bool enable_pixel_output = false;
ui::ContextFactory* context_factory =
ui::InitializeContextFactoryForTests(enable_pixel_output);
test_helper_.reset(
ViewsTestHelper::Create(base::MessageLoopForUI::current(),
context_factory));
test_helper_->SetUp();
Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
params.context = test_helper_->GetContext();
params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
parent_widget_.reset(new Widget);
parent_widget_->Init(params);
media_list_ = new FakeDesktopMediaList();
scoped_ptr<FakeDesktopMediaList> media_list(media_list_);
base::string16 app_name = base::ASCIIToUTF16("foo");
picker_views_.reset(new DesktopMediaPickerViews());
picker_views_->Show(NULL,
NULL,
parent_widget_->GetNativeWindow(),
app_name,
app_name,
media_list.PassAs<DesktopMediaList>(),
base::Bind(&DesktopMediaPickerViewsTest::OnPickerDone,
base::Unretained(this)));
}
virtual void TearDown() OVERRIDE {
test_helper_->TearDown();
ui::TerminateContextFactoryForTests();
}
DesktopMediaPickerDialogView* GetPickerDialogView() const {
return picker_views_->GetDialogViewForTesting();
}
MOCK_METHOD1(OnPickerDone, void(content::DesktopMediaID));
protected:
content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<views::ViewsTestHelper> test_helper_;
FakeDesktopMediaList* media_list_;
scoped_ptr<Widget> parent_widget_;
scoped_ptr<DesktopMediaPickerViews> picker_views_;
};
TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledWhenWindowClosed) {
EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID()));
GetPickerDialogView()->GetWidget()->Close();
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnOkButtonPressed) {
const int kFakeId = 222;
EXPECT_CALL(*this,
OnPickerDone(content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, kFakeId)));
media_list_->AddSource(kFakeId);
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus();
EXPECT_TRUE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
GetPickerDialogView()->Accept();
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleClick) {
const int kFakeId = 222;
EXPECT_CALL(*this,
OnPickerDone(content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, kFakeId)));
media_list_->AddSource(kFakeId);
ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED,
gfx::Point(),
gfx::Point(),
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
ui::EF_LEFT_MOUSE_BUTTON);
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnMousePressed(
double_click);
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleTap) {
const int kFakeId = 222;
EXPECT_CALL(*this,
OnPickerDone(content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, kFakeId)));
media_list_->AddSource(kFakeId);
ui::GestureEvent double_tap(
10,
10,
0,
base::TimeDelta(),
ui::GestureEventDetails(ui::ET_GESTURE_TAP, 2, 0));
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent(
&double_tap);
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsTest, CancelButtonAlwaysEnabled) {
EXPECT_TRUE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL));
}
// Verifies that the MediaSourceView is added or removed when |media_list_| is
// updated.
TEST_F(DesktopMediaPickerViewsTest, AddAndRemoveMediaSource) {
// No media source at first.
EXPECT_EQ(NULL, GetPickerDialogView()->GetMediaSourceViewForTesting(0));
for (int i = 0; i < 3; ++i) {
media_list_->AddSource(i);
EXPECT_TRUE(GetPickerDialogView()->GetMediaSourceViewForTesting(i));
}
for (int i = 2; i >= 0; --i) {
media_list_->RemoveSource(i);
EXPECT_EQ(NULL, GetPickerDialogView()->GetMediaSourceViewForTesting(i));
}
}
// Verifies that focusing the MediaSourceView marks it selected and the
// original selected MediaSourceView gets unselected.
TEST_F(DesktopMediaPickerViewsTest, FocusMediaSourceViewToSelect) {
media_list_->AddSource(0);
media_list_->AddSource(1);
DesktopMediaSourceView* source_view_0 =
GetPickerDialogView()->GetMediaSourceViewForTesting(0);
DesktopMediaSourceView* source_view_1 =
GetPickerDialogView()->GetMediaSourceViewForTesting(1);
EXPECT_FALSE(source_view_0->is_selected());
EXPECT_FALSE(source_view_1->is_selected());
source_view_0->OnFocus();
EXPECT_TRUE(source_view_0->is_selected());
// Removing the focus does not undo the selection.
source_view_0->OnBlur();
EXPECT_TRUE(source_view_0->is_selected());
source_view_1->OnFocus();
EXPECT_FALSE(source_view_0->is_selected());
EXPECT_TRUE(source_view_1->is_selected());
}
TEST_F(DesktopMediaPickerViewsTest, OkButtonDisabledWhenNoSelection) {
media_list_->AddSource(111);
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus();
EXPECT_TRUE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
media_list_->RemoveSource(0);
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
}
} // namespace views
......@@ -1953,6 +1953,7 @@
'browser/ui/views/crypto_module_password_dialog_view.cc',
'browser/ui/views/crypto_module_password_dialog_view.h',
'browser/ui/views/desktop_media_picker_views.cc',
'browser/ui/views/desktop_media_picker_views.h',
'browser/ui/views/detachable_toolbar_view.cc',
'browser/ui/views/detachable_toolbar_view.h',
'browser/ui/views/download/download_danger_prompt_views.cc',
......
......@@ -1780,6 +1780,7 @@
'browser/ui/views/confirm_bubble_views_unittest.cc',
'browser/ui/views/constrained_window_views_unittest.cc',
'browser/ui/views/crypto_module_password_dialog_view_unittest.cc',
'browser/ui/views/desktop_media_picker_views_unittest.cc',
'browser/ui/views/extensions/browser_action_drag_data_unittest.cc',
'browser/ui/views/extensions/media_galleries_dialog_views_unittest.cc',
'browser/ui/views/first_run_bubble_unittest.cc',
......
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