#include "base/memory/raw_ptr.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "base/callback_list.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_timeouts.h"
#include "chrome/browser/cart/cart_service.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/common/pref_names.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/proto/cart_db_content.pb.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/prefs/pref_service.h"
#include "components/search/ntp_features.h"
#include "components/session_proto_db/session_proto_db.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace {
std::string BuildPartnerMerchantPattern(
std::vector<std::string>& parter_merchant_list) { … }
std::unique_ptr<net::test_server::HttpResponse> BasicResponse(
bool return_empty_response,
const net::test_server::HttpRequest& request) { … }
cart_db::ChromeCartContentProto BuildCartProto(const char* domain,
const char* merchant_url) { … }
cart_db::ChromeCartContentProto BuildCartProtoWithCoupon(
const char* domain,
const char* merchant_url) { … }
ShoppingCarts;
testing::Matcher<autofill::DisplayStrings> EqualsDisplayStrings(
const autofill::DisplayStrings& display_strings) { … }
}
class FetchDiscountWorkerBrowserTest : public InProcessBrowserTest { … };
class FetchFLCodelessDiscountWorkerBrowserTest
: public FetchDiscountWorkerBrowserTest { … };
IN_PROC_BROWSER_TEST_F(FetchFLCodelessDiscountWorkerBrowserTest,
SimplePercentOffTest) { … }
IN_PROC_BROWSER_TEST_F(FetchFLCodelessDiscountWorkerBrowserTest,
SimpleDollarOffTest) { … }
IN_PROC_BROWSER_TEST_F(FetchFLCodelessDiscountWorkerBrowserTest,
NoDiscountForThisMerchantTest) { … }
IN_PROC_BROWSER_TEST_F(FetchFLCodelessDiscountWorkerBrowserTest,
TwoCartsOneWithDiscountOneWithoutDiscount) { … }
IN_PROC_BROWSER_TEST_F(FetchFLCodelessDiscountWorkerBrowserTest,
CartDiscountBecomeUnavailable) { … }
class FetchFLCodeDiscountWorkerBrowserTest
: public FetchDiscountWorkerBrowserTest { … };
IN_PROC_BROWSER_TEST_F(FetchFLCodeDiscountWorkerBrowserTest,
TwoCartsOneWithDiscountOneWithoutDiscount) { … }
IN_PROC_BROWSER_TEST_F(FetchFLCodeDiscountWorkerBrowserTest,
SimplePercentDiscountWithCodeTest) { … }
IN_PROC_BROWSER_TEST_F(FetchFLCodeDiscountWorkerBrowserTest,
IgnoreNotSupportedType_RBD_WITH_CODE) { … }
class FetchCodeBasedDiscountWorkerBrowserTest
: public FetchDiscountWorkerBrowserTest { … };
IN_PROC_BROWSER_TEST_F(FetchCodeBasedDiscountWorkerBrowserTest,
TwoCartsOneWithDiscountOneWithoutDiscount) { … }
IN_PROC_BROWSER_TEST_F(FetchCodeBasedDiscountWorkerBrowserTest,
SimplePercentDiscountWithCodeTest) { … }
IN_PROC_BROWSER_TEST_F(
FetchCodeBasedDiscountWorkerBrowserTest,
SimulateServerFlagIsOffByNotReturningTheRBDWithCodeType) { … }