NetworkProfilerStage extends StreamingStage implements CodeNavigator.Listener { @NotNull public RangeSelectionModel getRangeSelectionModel() { return myRangeSelectionModel; } NetworkProfilerStage(StudioProfilers profilers); boolean hasUserUsedNetworkSelection(); @NotNull NetworkConnectionsModel getConnectionsModel(); @NotNull RangeSelectionModel getRangeSelectionModel(); @NotNull StackTraceModel getStackTraceModel(); @NotNull HttpDataFetcher getHttpDataFetcher(); boolean setSelectedConnection(@Nullable HttpData data); @Nullable HttpData getSelectedConnection(); @NotNull AspectModel<NetworkProfilerAspect> getAspect(); @Override void enter(); @Override void exit(); @NotNull String getName(); @NotNull DetailedNetworkUsage getDetailedNetworkUsage(); @NotNull AxisComponentModel getTrafficAxis(); @NotNull AxisComponentModel getConnectionsAxis(); @NotNull NetworkStageLegends getLegends(); @NotNull NetworkStageLegends getTooltipLegends(); @NotNull EaseOutModel getInstructionsEaseOutModel(); @NotNull EventMonitor getEventMonitor(); @Override void onNavigated(@NotNull CodeLocation location);  }
@Test public void selectionDisabledWithoutAgent() { Range selection = myStage.getTimeline().getSelectionRange(); myTransportService.setAgentStatus(DEFAULT_AGENT_ATTACHED_RESPONSE); myTimer.tick(TimeUnit.SECONDS.toNanos(1)); myStage.getStudioProfilers().setStage(myStage); assertThat(myStage.getStudioProfilers().isAgentAttached()).isTrue(); myStage.getRangeSelectionModel().set(0, 100); assertThat(selection.getMin()).isWithin(EPSILON).of(0); assertThat(selection.getMax()).isWithin(EPSILON).of(100); myTransportService.setAgentStatus(DEFAULT_AGENT_DETACHED_RESPONSE); myTimer.tick(TimeUnit.SECONDS.toNanos(1)); assertThat(myStage.getStudioProfilers().isAgentAttached()).isFalse(); myStage.getRangeSelectionModel().set(100, 200); assertThat(selection.getMin()).isWithin(EPSILON).of(0); assertThat(selection.getMax()).isWithin(EPSILON).of(100); }