| 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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // The view under test. | 77 // The view under test. |
| 78 WebShareTargetPickerView* view() { return view_; } | 78 WebShareTargetPickerView* view() { return view_; } |
| 79 // The table inside the view (for inspection). | 79 // The table inside the view (for inspection). |
| 80 views::TableView* table() { return view_->table_; } | 80 views::TableView* table() { return view_->table_; } |
| 81 | 81 |
| 82 // The result that was returned to the dialog's callback. | 82 // The result that was returned to the dialog's callback. |
| 83 const base::Optional<std::string>& result() { return result_; } | 83 const base::Optional<std::string>& result() { return result_; } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 void OnCallback(base::Optional<std::string> result) { | 86 void OnCallback(const base::Optional<std::string>& result) { |
| 87 result_ = result; | 87 result_ = result; |
| 88 if (quit_closure_) | 88 if (quit_closure_) |
| 89 quit_closure_.Run(); | 89 quit_closure_.Run(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 std::unique_ptr<views::Widget> parent_widget_; | 92 std::unique_ptr<views::Widget> parent_widget_; |
| 93 WebShareTargetPickerView* view_ = nullptr; | 93 WebShareTargetPickerView* view_ = nullptr; |
| 94 | 94 |
| 95 base::Optional<std::string> result_; | 95 base::Optional<std::string> result_; |
| 96 | 96 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 base::RunLoop run_loop; | 164 base::RunLoop run_loop; |
| 165 SetQuitClosure(run_loop.QuitClosure()); | 165 SetQuitClosure(run_loop.QuitClosure()); |
| 166 | 166 |
| 167 view()->OnDoubleClick(); | 167 view()->OnDoubleClick(); |
| 168 | 168 |
| 169 run_loop.Run(); | 169 run_loop.Run(); |
| 170 | 170 |
| 171 EXPECT_EQ(base::Optional<std::string>("https://appone.com/path/bits"), | 171 EXPECT_EQ(base::Optional<std::string>("https://appone.com/path/bits"), |
| 172 result()); | 172 result()); |
| 173 } | 173 } |
| OLD | NEW |