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

Side by Side Diff: chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: LayoutDelegate -> LayoutProvider Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h" 5 #include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/media/webrtc/fake_desktop_media_list.h" 13 #include "chrome/browser/media/webrtc/fake_desktop_media_list.h"
14 #include "chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h" 14 #include "chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h"
15 #include "chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h" 15 #include "chrome/browser/ui/views/desktop_capture/desktop_media_source_view.h"
16 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
16 #include "components/web_modal/test_web_contents_modal_dialog_host.h" 17 #include "components/web_modal/test_web_contents_modal_dialog_host.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
21 #include "ui/events/event_utils.h" 22 #include "ui/events/event_utils.h"
22 #include "ui/views/controls/button/checkbox.h" 23 #include "ui/views/controls/button/checkbox.h"
23 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" 24 #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
24 #include "ui/views/test/scoped_views_test_helper.h" 25 #include "ui/views/test/scoped_views_test_helper.h"
26 #include "ui/views/test/test_views_delegate.h"
25 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
26 #include "ui/views/window/dialog_client_view.h" 28 #include "ui/views/window/dialog_client_view.h"
27 #include "ui/views/window/dialog_delegate.h" 29 #include "ui/views/window/dialog_delegate.h"
28 30
29 using content::DesktopMediaID; 31 using content::DesktopMediaID;
30 32
31 namespace views { 33 namespace views {
32 34
33 const std::vector<DesktopMediaID::Type> kSourceTypes = { 35 const std::vector<DesktopMediaID::Type> kSourceTypes = {
34 DesktopMediaID::TYPE_SCREEN, DesktopMediaID::TYPE_WINDOW, 36 DesktopMediaID::TYPE_SCREEN, DesktopMediaID::TYPE_WINDOW,
35 DesktopMediaID::TYPE_WEB_CONTENTS}; 37 DesktopMediaID::TYPE_WEB_CONTENTS};
36 38
37 class DesktopMediaPickerViewsTest : public testing::Test { 39 class DesktopMediaPickerViewsTest : public testing::Test {
38 public: 40 public:
39 DesktopMediaPickerViewsTest() {} 41 DesktopMediaPickerViewsTest() {}
40 ~DesktopMediaPickerViewsTest() override {} 42 ~DesktopMediaPickerViewsTest() override {}
41 43
42 void SetUp() override { 44 void SetUp() override {
45 test_helper_.test_views_delegate()->set_layout_provider(
46 ChromeLayoutProvider::CreateLayoutProvider());
43 media_lists_[DesktopMediaID::TYPE_SCREEN] = new FakeDesktopMediaList(); 47 media_lists_[DesktopMediaID::TYPE_SCREEN] = new FakeDesktopMediaList();
44 media_lists_[DesktopMediaID::TYPE_WINDOW] = new FakeDesktopMediaList(); 48 media_lists_[DesktopMediaID::TYPE_WINDOW] = new FakeDesktopMediaList();
45 media_lists_[DesktopMediaID::TYPE_WEB_CONTENTS] = 49 media_lists_[DesktopMediaID::TYPE_WEB_CONTENTS] =
46 new FakeDesktopMediaList(); 50 new FakeDesktopMediaList();
47 std::unique_ptr<FakeDesktopMediaList> screen_list( 51 std::unique_ptr<FakeDesktopMediaList> screen_list(
48 media_lists_[DesktopMediaID::TYPE_SCREEN]); 52 media_lists_[DesktopMediaID::TYPE_SCREEN]);
49 std::unique_ptr<FakeDesktopMediaList> window_list( 53 std::unique_ptr<FakeDesktopMediaList> window_list(
50 media_lists_[DesktopMediaID::TYPE_WINDOW]); 54 media_lists_[DesktopMediaID::TYPE_WINDOW]);
51 std::unique_ptr<FakeDesktopMediaList> tab_list( 55 std::unique_ptr<FakeDesktopMediaList> tab_list(
52 media_lists_[DesktopMediaID::TYPE_WEB_CONTENTS]); 56 media_lists_[DesktopMediaID::TYPE_WEB_CONTENTS]);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 318
315 EXPECT_TRUE(ClickSourceTypeButton(DesktopMediaID::TYPE_WEB_CONTENTS)); 319 EXPECT_TRUE(ClickSourceTypeButton(DesktopMediaID::TYPE_WEB_CONTENTS));
316 GetPickerDialogView()->GetCheckboxForTesting()->SetChecked(true); 320 GetPickerDialogView()->GetCheckboxForTesting()->SetChecked(true);
317 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); 321 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus();
318 322
319 GetPickerDialogView()->GetDialogClientView()->AcceptWindow(); 323 GetPickerDialogView()->GetDialogClientView()->AcceptWindow();
320 base::RunLoop().RunUntilIdle(); 324 base::RunLoop().RunUntilIdle();
321 } 325 }
322 326
323 } // namespace views 327 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698