| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/webshare/webshare_target_picker_view.h" | 5 #include "chrome/browser/ui/views/webshare/webshare_target_picker_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/optional.h" | 12 #include "base/optional.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 16 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 17 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 17 #include "chrome/test/base/browser_with_test_window_test.h" | 18 #include "chrome/test/base/browser_with_test_window_test.h" |
| 18 #include "components/constrained_window/constrained_window_views.h" | 19 #include "components/constrained_window/constrained_window_views.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/views/controls/table/table_view.h" | 21 #include "ui/views/controls/table/table_view.h" |
| 21 #include "ui/views/test/views_test_base.h" | 22 #include "ui/views/test/views_test_base.h" |
| 22 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 23 #include "ui/views/window/dialog_client_view.h" | 24 #include "ui/views/window/dialog_client_view.h" |
| 24 #include "ui/views/window/dialog_delegate.h" | 25 #include "ui/views/window/dialog_delegate.h" |
| 25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 26 | 27 |
| 27 class WebShareTargetPickerViewTest : public views::ViewsTestBase { | 28 class WebShareTargetPickerViewTest : public views::ViewsTestBase { |
| 28 public: | 29 public: |
| 29 WebShareTargetPickerViewTest() {} | 30 WebShareTargetPickerViewTest() {} |
| 30 | 31 |
| 31 void SetUp() override { | 32 void SetUp() override { |
| 32 ViewsTestBase::SetUp(); | 33 ViewsTestBase::SetUp(); |
| 33 | 34 |
| 35 test_views_delegate()->set_layout_provider( |
| 36 ChromeLayoutProvider::CreateLayoutProvider()); |
| 37 |
| 34 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 38 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
| 35 | 39 |
| 36 // Create the parent widget. | 40 // Create the parent widget. |
| 37 views::Widget::InitParams params = | 41 views::Widget::InitParams params = |
| 38 CreateParams(views::Widget::InitParams::TYPE_WINDOW); | 42 CreateParams(views::Widget::InitParams::TYPE_WINDOW); |
| 39 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 43 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 40 | 44 |
| 41 parent_widget_.reset(new views::Widget()); | 45 parent_widget_.reset(new views::Widget()); |
| 42 parent_widget_->Init(params); | 46 parent_widget_->Init(params); |
| 43 parent_widget_->Show(); | 47 parent_widget_->Show(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 base::RunLoop run_loop; | 164 base::RunLoop run_loop; |
| 161 SetQuitClosure(run_loop.QuitClosure()); | 165 SetQuitClosure(run_loop.QuitClosure()); |
| 162 | 166 |
| 163 view()->OnDoubleClick(); | 167 view()->OnDoubleClick(); |
| 164 | 168 |
| 165 run_loop.Run(); | 169 run_loop.Run(); |
| 166 | 170 |
| 167 EXPECT_EQ(base::Optional<std::string>("https://appone.com/path/bits"), | 171 EXPECT_EQ(base::Optional<std::string>("https://appone.com/path/bits"), |
| 168 result()); | 172 result()); |
| 169 } | 173 } |
| OLD | NEW |