chromium/chrome/browser/new_tab_page/one_google_bar/one_google_bar_loader_impl_unittest.cc

// Copyright 2017 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/new_tab_page/one_google_bar/one_google_bar_loader_impl.h"

#include <optional>

#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/new_tab_page/one_google_bar/one_google_bar_data.h"
#include "components/signin/core/browser/signin_header_helper.h"
#include "components/variations/scoped_variations_ids_provider.h"
#include "content/public/test/browser_task_environment.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_test_helper.h"
#endif

_;
DoAll;
Eq;
IsEmpty;
SaveArg;
StartsWith;

namespace {

const char kApplicationLocale[] =;

const char kMinimalValidResponse[] =;

// Returns the value of the "enable_account_consistency" parameter in the
// "X-ChromeConnected" header. The header is expected to be in the format:
//    param1=value1,param2=value2,[...],paramN=valueN
// If the "enable_account_consistency" parameter is not found, returns the empty
// string.
std::string GetEnableAccountConsistencyValue(
    const std::string& chrome_connected_header) {}

}  // namespace

ACTION_P(Quit, run_loop) {}

class OneGoogleBarLoaderImplTest : public testing::Test {};

TEST_F(OneGoogleBarLoaderImplTest, RequestUrlContainsLanguage) {}

TEST_F(OneGoogleBarLoaderImplTest, RequestUrlWithAdditionalQueryParams) {}

TEST_F(OneGoogleBarLoaderImplTest, RequestReturns) {}

TEST_F(OneGoogleBarLoaderImplTest, HandlesResponsePreamble) {}

TEST_F(OneGoogleBarLoaderImplTest, ParsesFullResponse) {}

TEST_F(OneGoogleBarLoaderImplTest, CoalescesMultipleRequests) {}

TEST_F(OneGoogleBarLoaderImplTest, NetworkErrorIsTransient) {}

TEST_F(OneGoogleBarLoaderImplTest, InvalidJsonErrorIsFatal) {}

TEST_F(OneGoogleBarLoaderImplTest, IncompleteJsonErrorIsFatal) {}

TEST_F(OneGoogleBarLoaderImplTest, MirrorAccountConsistencyNotRequired) {}

class OneGoogleBarLoaderImplWithMirrorAccountConsistencyTest
    : public OneGoogleBarLoaderImplTest {};

TEST_F(OneGoogleBarLoaderImplWithMirrorAccountConsistencyTest,
       MirrorAccountConsistencyRequired) {}

TEST_F(OneGoogleBarLoaderImplTest, ParsesLanguageCode) {}