In the past, P2PPortAllocator.enable_multiple_routes is the indicator whether we should bind to the any address. It's easy to translate that into a port allocator flag in P2PPortAllocator's ctor. Going forward, we have to depend on an asynchronous permission check to determine whether gathering local address is allowed or not, hence the current way of passing it through constructor approach won't work any more. The asynchronous check will trigger SignalNetowrksChanged so we could only check that inside DoAllocate.

Adapter enumeration disable should be a concept from Network. Network will be hooked up with media permission (mic/camera) to check whether gathering local address is allowed.

BUG=crbug.com/520101
R=juberti@webrtc.org, pthatcher@webrtc.org

Committed: ba9ab4cd8d

Review URL: https://codereview.webrtc.org/1284113003 .

Cr-Commit-Position: refs/heads/master@{#9735}
This commit is contained in:
Guo-wei Shieh
2015-08-19 10:32:46 -07:00
parent 5d69648782
commit 47872ec90c
6 changed files with 73 additions and 3 deletions

View File

@ -177,11 +177,14 @@ TEST_F(NetworkTest, DISABLED_TestCreateNetworks) {
}
}
// Test that UpdateNetworks succeeds.
// Test StartUpdating() and StopUpdating(). network_permission_state starts with
// ALLOWED.
TEST_F(NetworkTest, TestUpdateNetworks) {
BasicNetworkManager manager;
manager.SignalNetworksChanged.connect(
static_cast<NetworkTest*>(this), &NetworkTest::OnNetworksChanged);
EXPECT_EQ(manager.enumeration_permission(),
NetworkManager::kEnumerationAllowed);
manager.StartUpdating();
Thread::Current()->ProcessMessages(0);
EXPECT_TRUE(callback_called_);
@ -195,6 +198,8 @@ TEST_F(NetworkTest, TestUpdateNetworks) {
manager.StopUpdating();
EXPECT_TRUE(manager.started());
manager.StopUpdating();
EXPECT_EQ(manager.enumeration_permission(),
NetworkManager::kEnumerationAllowed);
EXPECT_FALSE(manager.started());
manager.StopUpdating();
EXPECT_FALSE(manager.started());