chromium/chrome/browser/extensions/webstore_reinstaller_browsertest.cc

// Copyright 2014 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/extensions/webstore_reinstaller.h"

#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/webstore_data_fetcher.h"
#include "chrome/browser/extensions/webstore_installer_test.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/extensions/webstore_install_result.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"

namespace extensions {

namespace {

constexpr char kWebstoreDomain[] =;
constexpr char kAppDomain[] =;
constexpr char kNonAppDomain[] =;
constexpr char kTestExtensionId[] =;
constexpr char kTestDataPath[] =;
constexpr char kCrxFilename[] =;

// The values of the mock protobuf response should match those in the JSON API
// that's stored in "chrome/test/data/extensions/api_test/" +
// "webstore_inline_install/inlineinstall/detail/" +
// "ecglahbcnmdpdciemllbhojghbkagdje".
constexpr char kMockTitle[] =;
constexpr char kMockUserCountString[] =;
constexpr double kMockAverageRating =;
constexpr int kMockRatingCount =;
constexpr char kMockRatingCountString[] =;
constexpr char kMockLogoUri[] =;
constexpr char kMockManifest[] =;

std::unique_ptr<FetchItemSnippetResponse> CreateMockResponse(
    const ExtensionId& id) {}

}  // namespace

class WebstoreReinstallerBrowserTest : public WebstoreInstallerTest {};

void WebstoreReinstallerBrowserTest::OnInstallCompletion(
    base::OnceClosure quit_closure,
    bool success,
    const std::string& error,
    webstore_install::Result result) {}

// TODO(crbug.com/325314721): Remove this test once we stop using the old item
// JSON API to fetch webstore data.
IN_PROC_BROWSER_TEST_F(WebstoreReinstallerBrowserTest, TestWebstoreReinstall) {}

class WebstoreReinstallerItemSnippetsBrowserTest
    : public WebstoreReinstallerBrowserTest {};

// A version of the WebstoreReinstallerBrowserTest test with the same name
// except this tests that reinstalls for corrupted extensions work when using
// the new item snippets API which returns a protobuf object for web store data
// (the API return is mocked for this test).
IN_PROC_BROWSER_TEST_F(WebstoreReinstallerItemSnippetsBrowserTest,
                       TestWebstoreReinstall) {}

}  // namespace extensions