tests/ceftests/urlrequest_unittest.cc
// Tests if the save cookie has been set. If set, it will be deleted at the same
// time.
Tests if the save cookie has been set. If set, it will be deleted at the same
time.
Tests if the save cookie has been set . If set it will be deleted at the same time .
void GetTestCookie(CefRefPtr<CefRequestContext> request_context,
                   bool server_backend,
                   GetTestCookieCallback callback) {
  class Visitor : public CefCookieVisitor {
   public:
    explicit Visitor(GetTestCookieCallback callback)
        : callback_(std::move(callback)), cookie_exists_(false) {
      EXPECT_FALSE(callback_.is_null());
    }
    ~Visitor() override { std::move(callback_).Run(cookie_exists_); }
    bool Visit(const CefCookie& cookie,
               int count,
               int total,
               bool& deleteCookie) override {
      std::string cookie_name = CefString(&cookie.name);
      if (cookie_name == kRequestSaveCookieName) {
        cookie_exists_ = true;
        deleteCookie = true;
        return false;
      }
      return true;
    }
   private:
    GetTestCookieCallback callback_;
    bool cookie_exists_;
    IMPLEMENT_REFCOUNTING(Visitor);
  };
  CefRefPtr<CefCookieManager> cookie_manager =
      request_context->GetCookieManager(nullptr);
  cookie_manager->VisitUrlCookies(GetRequestOrigin(server_backend), true,
                                  new Visitor(std::move(callback)));
}
void GetTestCookie ( CefRefPtr < CefRequestContext > request_context , bool server_backend , GetTestCookieCallback callback ) { class Visitor : public CefCookieVisitor { public : explicit Visitor ( GetTestCookieCallback callback ) : callback_ ( std :: move ( callback ) ) , cookie_exists_ ( false ) { EXPECT_FALSE ( callback_ . is_null ( ) ) ; } ~ Visitor ( ) override { std :: move ( callback_ ) . Run ( cookie_exists_ ) ; } bool Visit ( const CefCookie & cookie , int count , int total , bool & deleteCookie ) override { std :: string cookie_name = CefString ( & cookie . name ) ; if ( cookie_name == kRequestSaveCookieName ) { cookie_exists_ = true ; deleteCookie = true ; return false ; } return true ; } private : GetTestCookieCallback callback_ ; bool cookie_exists_ ; IMPLEMENT_REFCOUNTING ( Visitor ) ; } ; CefRefPtr < CefCookieManager > cookie_manager = request_context -> GetCookieManager ( nullptr ) ; cookie_manager -> VisitUrlCookies ( GetRequestOrigin ( server_backend ) , true , new Visitor ( std :: move ( callback ) ) ) ; }
Tests if the save cookie has been set.
Tests if the save cookie has been set .