CaptureModel { public void setDetails(@Nullable CaptureDetails.Type type) { if (type != null && myDetails != null && type == myDetails.getType()) { return; } FeatureTracker tracker = myStage.getStudioProfilers().getIdeServices().getFeatureTracker(); if (type != null) { DETAILS_TRACKERS.get(type).accept(tracker); } rebuildDetails(type); } CaptureModel(@NotNull CpuProfilerStage stage); boolean setCapture(@Nullable CpuCapture capture); @Nullable CpuCapture getCapture(); void setThread(int thread); int getThread(); void setClockType(@NotNull ClockType type); @NotNull ClockType getClockType(); @NotNull FilterResult applyFilter(@NotNull Filter filter); @NotNull Filter getFilter(); void setDetails(@Nullable CaptureDetails.Type type); @Nullable CaptureDetails getDetails(); static final int NO_THREAD; }
@Test public void testDetailsFeatureTracking() { FakeFeatureTracker tracker = (FakeFeatureTracker)myStage.getStudioProfilers().getIdeServices().getFeatureTracker(); assertThat(tracker.getLastCaptureDetailsType()).isNull(); myModel.setDetails(CaptureDetails.Type.CALL_CHART); assertThat(tracker.getLastCaptureDetailsType()).isEqualTo(CaptureDetails.Type.CALL_CHART); myModel.setDetails(CaptureDetails.Type.FLAME_CHART); assertThat(tracker.getLastCaptureDetailsType()).isEqualTo(CaptureDetails.Type.FLAME_CHART); myModel.setDetails(CaptureDetails.Type.TOP_DOWN); assertThat(tracker.getLastCaptureDetailsType()).isEqualTo(CaptureDetails.Type.TOP_DOWN); myModel.setDetails(CaptureDetails.Type.BOTTOM_UP); assertThat(tracker.getLastCaptureDetailsType()).isEqualTo(CaptureDetails.Type.BOTTOM_UP); }