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

Unified Diff: chrome/browser/devtools/device/port_forwarding_browsertest.cc

Issue 503763002: DevTools: Test for disabling PortForwardingController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698