| Index: chrome/browser/devtools/device/port_forwarding_browsertest.cc
|
| diff --git a/chrome/browser/devtools/device/port_forwarding_browsertest.cc b/chrome/browser/devtools/device/port_forwarding_browsertest.cc
|
| index f2ca1e4c8a19157813a7686237b55e3f40558522..e8407a4c26898cda87401b6023e773928a16f9c5 100644
|
| --- a/chrome/browser/devtools/device/port_forwarding_browsertest.cc
|
| +++ b/chrome/browser/devtools/device/port_forwarding_browsertest.cc
|
| @@ -38,7 +38,8 @@ class PortForwardingTest: public InProcessBrowserTest {
|
| class Listener : public PortForwardingController::Listener {
|
| public:
|
| explicit Listener(Profile* profile)
|
| - : profile_(profile) {
|
| + : profile_(profile),
|
| + skip_empty_devices_(true) {
|
| PortForwardingController::Factory::GetForProfile(profile_)->
|
| AddListener(this);
|
| }
|
| @@ -49,14 +50,19 @@ class PortForwardingTest: public InProcessBrowserTest {
|
| }
|
|
|
| virtual void PortStatusChanged(const DevicesStatus& status) OVERRIDE {
|
| - if (status.empty())
|
| + if (status.empty() && skip_empty_devices_)
|
| return;
|
| base::MessageLoop::current()->PostTask(
|
| FROM_HERE, base::MessageLoop::QuitClosure());
|
| }
|
|
|
| + void set_skip_empty_devices(bool skip_empty_devices) {
|
| + skip_empty_devices_ = skip_empty_devices;
|
| + }
|
| +
|
| private:
|
| Profile* profile_;
|
| + bool skip_empty_devices_;
|
| };
|
| };
|
|
|
| @@ -115,4 +121,9 @@ IN_PROC_BROWSER_TEST_F(PortForwardingTest,
|
| "window.domAutomationController.send(getBodyMarginLeft())",
|
| &result));
|
| ASSERT_EQ("100px", result) << "CSS has not loaded.";
|
| +
|
| + // Test that disabling port forwarding is handled normally.
|
| + wait_for_port_forwarding.set_skip_empty_devices(false);
|
| + prefs->SetBoolean(prefs::kDevToolsPortForwardingEnabled, false);
|
| + content::RunMessageLoop();
|
| }
|
|
|