Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix RegisterSendSurfaceAlreadyReceivingNotDiscovering test
Removes pending TODO and implements the test for registering a send surface
when we are already receiving incoming files.

Change-Id: I9dd8955b4c423ed6b567ebb2028ed839b9a1f63f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2382753
Auto-Submit: Himanshu Jaju <himanshujaju@chromium.org>
Commit-Queue: James Vecore <vecore@google.com>
Reviewed-by: James Vecore <vecore@google.com>
Cr-Commit-Position: refs/heads/master@{#802867}
  • Loading branch information
Himanshu Jaju authored and Commit Bot committed Aug 29, 2020
1 parent 59dd9f2 commit 1d35af8
Showing 1 changed file with 14 additions and 8 deletions.
Expand Up @@ -1094,14 +1094,20 @@ TEST_F(NearbySharingServiceImplTest,

TEST_F(NearbySharingServiceImplTest,
RegisterSendSurfaceAlreadyReceivingNotDiscovering) {
ui::ScopedSetIdleState unlocked(ui::IDLE_STATE_IDLE);
SetConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI);
// TODO(himanshujaju) is_receiving_files_ should be set to true when
// receiving. Test that WHEN receiving files, THEN below passes.
// EXPECT_EQ(NearbySharingService::StatusCodes::kTransferAlreadyInProgress,
// RegisterSendSurface(SendSurfaceState::kForeground));
// EXPECT_FALSE(fake_nearby_connections_manager_->IsDiscovering());
// EXPECT_FALSE(fake_nearby_connections_manager_->is_shutdown());
NiceMock<MockTransferUpdateCallback> callback;
ShareTarget share_target = SetUpIncomingConnection(callback);
EXPECT_FALSE(connection_.IsClosed());

MockTransferUpdateCallback send_callback;
MockShareTargetDiscoveredCallback discovery_callback;
EXPECT_EQ(NearbySharingService::StatusCodes::kTransferAlreadyInProgress,
service_->RegisterSendSurface(&send_callback, &discovery_callback,
SendSurfaceState::kForeground));
EXPECT_FALSE(fake_nearby_connections_manager_->IsDiscovering());
EXPECT_FALSE(fake_nearby_connections_manager_->is_shutdown());

// To avoid UAF in OnIncomingTransferUpdate().
service_->UnregisterReceiveSurface(&callback);
}

TEST_F(NearbySharingServiceImplTest,
Expand Down

0 comments on commit 1d35af8

Please sign in to comment.