#include "cc/metrics/frame_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
namespace {
using FrameFinalState = FrameInfo::FrameFinalState;
using MainThreadResponse = FrameInfo::MainThreadResponse;
using SmoothThread = FrameInfo::SmoothThread;
TEST(FrameInfoTest, WasMainUpdateDroppedForkedReporters) {
FrameInfo main, compositor;
main.smooth_thread = SmoothThread::kSmoothBoth;
compositor.smooth_thread = SmoothThread::kSmoothCompositor;
main.main_thread_response = MainThreadResponse::kIncluded;
compositor.main_thread_response = MainThreadResponse::kMissing;
main.final_state = FrameFinalState::kPresentedAll;
compositor.final_state = FrameFinalState::kDropped;
auto test = main;
test.MergeWith(compositor);
EXPECT_TRUE(test.WasSmoothMainUpdateDropped());
EXPECT_TRUE(test.WasSmoothCompositorUpdateDropped());
compositor.final_state = FrameFinalState::kPresentedPartialOldMain;
test = main;
test.MergeWith(compositor);
EXPECT_TRUE(test.WasSmoothMainUpdateDropped());
EXPECT_FALSE(test.WasSmoothCompositorUpdateDropped());
compositor.final_state = FrameFinalState::kPresentedPartialNewMain;
test = main;
test.MergeWith(compositor);
EXPECT_FALSE(test.WasSmoothMainUpdateDropped());
EXPECT_FALSE(test.WasSmoothCompositorUpdateDropped());
}
}
}