tests/ceftests/urlrequest_unittest.cc
// Set a cookie so that we can test if it's sent with the request.
Set a cookie so that we can test if it's sent with the request.
Set a cookie so that we can test if it ' s sent with the request .
void SetTestCookie(CefRefPtr<CefRequestContext> request_context,
                   bool server_backend,
                   base::OnceClosure callback) {
  class Callback : public CefSetCookieCallback {
   public:
    explicit Callback(base::OnceClosure callback)
        : callback_(std::move(callback)) {
      EXPECT_FALSE(callback_.is_null());
    }
    void OnComplete(bool success) override {
      EXPECT_TRUE(success);
      std::move(callback_).Run();
    }
   private:
    base::OnceClosure callback_;
    IMPLEMENT_REFCOUNTING(Callback);
  };
  CefCookie cookie;
  CefString(&cookie.name) = kRequestSendCookieName;
  CefString(&cookie.value) = "send-cookie-value";
  CefString(&cookie.domain) = GetRequestHost(server_backend, false);
  CefString(&cookie.path) = "/";
  cookie.has_expires = false;
  EXPECT_TRUE(request_context->GetCookieManager(nullptr)->SetCookie(
      GetRequestOrigin(server_backend), cookie,
      new Callback(std::move(callback))));
}
void SetTestCookie ( CefRefPtr < CefRequestContext > request_context , bool server_backend , base :: OnceClosure callback ) { class Callback : public CefSetCookieCallback { public : explicit Callback ( base :: OnceClosure callback ) : callback_ ( std :: move ( callback ) ) { EXPECT_FALSE ( callback_ . is_null ( ) ) ; } void OnComplete ( bool success ) override { EXPECT_TRUE ( success ) ; std :: move ( callback_ ) . Run ( ) ; } private : base :: OnceClosure callback_ ; IMPLEMENT_REFCOUNTING ( Callback ) ; } ; CefCookie cookie ; CefString ( & cookie . name ) = kRequestSendCookieName ; CefString ( & cookie . value ) = " " ; CefString ( & cookie . domain ) = GetRequestHost ( server_backend , false ) ; CefString ( & cookie . path ) = " " ; cookie . has_expires = false ; EXPECT_TRUE ( request_context -> GetCookieManager ( nullptr ) -> SetCookie ( GetRequestOrigin ( server_backend ) , cookie , new Callback ( std :: move ( callback ) ) ) ) ; }
Set a cookie so that we can test if it's sent with the request.
Set a cookie so that we can test if it ' s sent with the request .