| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <queue> | 5 #include <queue> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 ~FakeDesktopMediaPicker() override { expectation_->picker_deleted = true; } | 48 ~FakeDesktopMediaPicker() override { expectation_->picker_deleted = true; } |
| 49 | 49 |
| 50 // DesktopMediaPicker interface. | 50 // DesktopMediaPicker interface. |
| 51 void Show(content::WebContents* web_contents, | 51 void Show(content::WebContents* web_contents, |
| 52 gfx::NativeWindow context, | 52 gfx::NativeWindow context, |
| 53 gfx::NativeWindow parent, | 53 gfx::NativeWindow parent, |
| 54 const base::string16& app_name, | 54 const base::string16& app_name, |
| 55 const base::string16& target_name, | 55 const base::string16& target_name, |
| 56 scoped_ptr<DesktopMediaList> model, | 56 scoped_ptr<DesktopMediaList> model, |
| 57 bool request_audio, |
| 57 const DoneCallback& done_callback) override { | 58 const DoneCallback& done_callback) override { |
| 58 if (!expectation_->cancelled) { | 59 if (!expectation_->cancelled) { |
| 59 // Post a task to call the callback asynchronously. | 60 // Post a task to call the callback asynchronously. |
| 60 base::ThreadTaskRunnerHandle::Get()->PostTask( | 61 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 61 FROM_HERE, | 62 FROM_HERE, |
| 62 base::Bind(&FakeDesktopMediaPicker::CallCallback, | 63 base::Bind(&FakeDesktopMediaPicker::CallCallback, |
| 63 weak_factory_.GetWeakPtr(), done_callback)); | 64 weak_factory_.GetWeakPtr(), done_callback)); |
| 64 } else { | 65 } else { |
| 65 // If we expect the dialog to be cancelled then store the callback to | 66 // If we expect the dialog to be cancelled then store the callback to |
| 66 // retain reference to the callback handler. | 67 // retain reference to the callback handler. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 EXPECT_TRUE(result); | 239 EXPECT_TRUE(result); |
| 239 EXPECT_TRUE(test_flags[2].picker_created); | 240 EXPECT_TRUE(test_flags[2].picker_created); |
| 240 EXPECT_FALSE(test_flags[2].picker_deleted); | 241 EXPECT_FALSE(test_flags[2].picker_deleted); |
| 241 | 242 |
| 242 web_contents->Close(); | 243 web_contents->Close(); |
| 243 destroyed_watcher.Wait(); | 244 destroyed_watcher.Wait(); |
| 244 EXPECT_TRUE(test_flags[2].picker_deleted); | 245 EXPECT_TRUE(test_flags[2].picker_deleted); |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace extensions | 248 } // namespace extensions |
| OLD | NEW |