chromium/chrome/browser/ui/thumbnails/thumbnail_capture_driver_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/thumbnails/thumbnail_capture_driver.h"

#include "base/test/task_environment.h"
#include "chrome/browser/ui/thumbnails/thumbnail_scheduler.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

class MockClient : public ThumbnailCaptureDriver::Client {};

class StubScheduler : public ThumbnailScheduler {};

class ThumbnailCaptureDriverTest : public ::testing::Test {};

}  // namespace

AnyNumber;
AtLeast;
Expectation;
InSequence;

TEST_F(ThumbnailCaptureDriverTest,
       NoCaptureWhenPageIsVisibleAndThumbnailIsNot) {}

TEST_F(ThumbnailCaptureDriverTest,
       CaptureWhenPageIsVisibleAndThumbnailIsRequested) {}

TEST_F(ThumbnailCaptureDriverTest, NoCaptureWhenPageAndThumbnailAreNotVisible) {}

TEST_F(ThumbnailCaptureDriverTest,
       CaptureRequestedWhenPageReadyAndSchedulerAllows) {}

TEST_F(ThumbnailCaptureDriverTest, CapturesPageWhenPossible) {}

TEST_F(ThumbnailCaptureDriverTest,
       AlwaysWaitsForSchedulerAndCallsRequestCapture) {}

TEST_F(ThumbnailCaptureDriverTest, FinalCaptureWaitsForScheduler) {}

TEST_F(ThumbnailCaptureDriverTest, StopsCaptureThenResumesFromScheduler) {}

TEST_F(ThumbnailCaptureDriverTest, RestartsCaptureWhenPossible) {}

TEST_F(ThumbnailCaptureDriverTest, StopsOngoingCaptureWhenPageNoLongerReady) {}

TEST_F(ThumbnailCaptureDriverTest, CanContinueCaptureIfPageBecomesVisible) {}

TEST_F(ThumbnailCaptureDriverTest, ContinuesCaptureWhenPageBecomesFinal) {}

TEST_F(ThumbnailCaptureDriverTest, StopsCaptureOnFinalFrame) {}

TEST_F(ThumbnailCaptureDriverTest, RetriesWithinLimits) {}

TEST_F(ThumbnailCaptureDriverTest, StopsCaptureAtRetryLimit) {}

TEST_F(ThumbnailCaptureDriverTest, DoesNotReCaptureAfterFinalThumbnail) {}

// Going from kReadyForFinalCapture to a lower readiness should always
// invalidate the current thumbnail. Capture should restart from
// scratch. Regression test for https://crbug.com/1137330
TEST_F(ThumbnailCaptureDriverTest, InvalidatesThumbnailOnReadinessDecrease) {}