tests/ceftests/parser_unittest.cc
// Parse the URL using scheme, host, path and query.
Parse the URL using scheme, host, path and query.
Parse the URL using scheme host path and query .
TEST(ParserTest, ParseURLSchemeHostPathQuery) {
  CefURLParts parts;
  CefString url;
  url.FromASCII("http://www.example.com/path/to.html?foo=test&bar=test2");
  EXPECT_TRUE(CefParseURL(url, parts));
  CefString spec(&parts.spec);
  EXPECT_STREQ("http://www.example.com/path/to.html?foo=test&bar=test2",
               spec.ToString().c_str());
  EXPECT_EQ(0U, parts.username.length);
  EXPECT_EQ(0U, parts.password.length);
  CefString scheme(&parts.scheme);
  EXPECT_STREQ("http", scheme.ToString().c_str());
  CefString host(&parts.host);
  EXPECT_STREQ("www.example.com", host.ToString().c_str());
  EXPECT_EQ(0U, parts.port.length);
  CefString origin(&parts.origin);
  EXPECT_STREQ(origin.ToString().c_str(), "http://www.example.com/");
  CefString path(&parts.path);
  EXPECT_STREQ("/path/to.html", path.ToString().c_str());
  CefString query(&parts.query);
  EXPECT_STREQ("foo=test&bar=test2", query.ToString().c_str());
}
TEST ( ParserTest , ParseURLSchemeHostPathQuery ) { CefURLParts parts ; CefString url ; url . FromASCII ( " " ) ; EXPECT_TRUE ( CefParseURL ( url , parts ) ) ; CefString spec ( & parts . spec ) ; EXPECT_STREQ ( " " , spec . ToString ( ) . c_str ( ) ) ; EXPECT_EQ ( 0U , parts . username . length ) ; EXPECT_EQ ( 0U , parts . password . length ) ; CefString scheme ( & parts . scheme ) ; EXPECT_STREQ ( " " , scheme . ToString ( ) . c_str ( ) ) ; CefString host ( & parts . host ) ; EXPECT_STREQ ( " " , host . ToString ( ) . c_str ( ) ) ; EXPECT_EQ ( 0U , parts . port . length ) ; CefString origin ( & parts . origin ) ; EXPECT_STREQ ( origin . ToString ( ) . c_str ( ) , " " ) ; CefString path ( & parts . path ) ; EXPECT_STREQ ( " " , path . ToString ( ) . c_str ( ) ) ; CefString query ( & parts . query ) ; EXPECT_STREQ ( " " , query . ToString ( ) . c_str ( ) ) ; }
Parse the URL using scheme, host, path and query.
Parse the URL using scheme host path and query .