mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-27 17:37:46 +01:00
chrome: Fix FrameTest and RequestHandlerTest failures (see issue #2969)
This commit is contained in:
parent
5318dfe252
commit
1c04d96468
@ -28,11 +28,6 @@ const char* kTestPath = "/path/to/cookietest";
|
|||||||
|
|
||||||
const int kIgnoreNumDeleted = -2;
|
const int kIgnoreNumDeleted = -2;
|
||||||
|
|
||||||
bool IgnoreURL(const std::string& url) {
|
|
||||||
return IsChromeRuntimeEnabled() &&
|
|
||||||
url.find("/favicon.ico") != std::string::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef std::vector<CefCookie> CookieVector;
|
typedef std::vector<CefCookie> CookieVector;
|
||||||
|
|
||||||
class TestCompletionCallback : public CefCompletionCallback {
|
class TestCompletionCallback : public CefCompletionCallback {
|
||||||
|
@ -424,10 +424,13 @@ class FrameNavTestHandler : public TestHandler {
|
|||||||
CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
CefRefPtr<CefRequest> request) override {
|
CefRefPtr<CefRequest> request) override {
|
||||||
|
const std::string& url = request->GetURL();
|
||||||
|
if (IgnoreURL(url))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
EXPECT_TRUE(expectations_->GetResourceHandler(browser, frame))
|
EXPECT_TRUE(expectations_->GetResourceHandler(browser, frame))
|
||||||
<< "nav = " << nav_;
|
<< "nav = " << nav_;
|
||||||
|
|
||||||
const std::string& url = request->GetURL();
|
|
||||||
const std::string& content = expectations_->GetContentForURL(url);
|
const std::string& content = expectations_->GetContentForURL(url);
|
||||||
EXPECT_TRUE(!content.empty()) << "nav = " << nav_;
|
EXPECT_TRUE(!content.empty()) << "nav = " << nav_;
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ class NetNotifyTestHandler : public TestHandler {
|
|||||||
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
||||||
|
|
||||||
const std::string& url = request->GetURL();
|
const std::string& url = request->GetURL();
|
||||||
|
if (IgnoreURL(url))
|
||||||
|
return RV_CONTINUE;
|
||||||
|
|
||||||
if (url.find(url1_) == 0)
|
if (url.find(url1_) == 0)
|
||||||
got_before_resource_load1_.yes();
|
got_before_resource_load1_.yes();
|
||||||
else if (url.find(url2_) == 0)
|
else if (url.find(url2_) == 0)
|
||||||
@ -118,6 +121,9 @@ class NetNotifyTestHandler : public TestHandler {
|
|||||||
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
||||||
|
|
||||||
const std::string& url = request->GetURL();
|
const std::string& url = request->GetURL();
|
||||||
|
if (IgnoreURL(url))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
if (url.find(url1_) == 0)
|
if (url.find(url1_) == 0)
|
||||||
got_get_resource_handler1_.yes();
|
got_get_resource_handler1_.yes();
|
||||||
else if (url.find(url2_) == 0)
|
else if (url.find(url2_) == 0)
|
||||||
@ -135,9 +141,12 @@ class NetNotifyTestHandler : public TestHandler {
|
|||||||
URLRequestStatus status,
|
URLRequestStatus status,
|
||||||
int64 received_content_length) override {
|
int64 received_content_length) override {
|
||||||
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
||||||
EXPECT_EQ(UR_SUCCESS, status);
|
|
||||||
|
|
||||||
const std::string& url = request->GetURL();
|
const std::string& url = request->GetURL();
|
||||||
|
if (IgnoreURL(url))
|
||||||
|
return;
|
||||||
|
|
||||||
|
EXPECT_EQ(UR_SUCCESS, status);
|
||||||
if (url.find(url1_) == 0) {
|
if (url.find(url1_) == 0) {
|
||||||
got_resource_load_complete1_.yes();
|
got_resource_load_complete1_.yes();
|
||||||
EXPECT_EQ(response_length1_, received_content_length);
|
EXPECT_EQ(response_length1_, received_content_length);
|
||||||
|
@ -291,6 +291,11 @@ bool IsChromeRuntimeEnabled() {
|
|||||||
return state ? true : false;
|
return state ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IgnoreURL(const std::string& url) {
|
||||||
|
return IsChromeRuntimeEnabled() &&
|
||||||
|
url.find("/favicon.ico") != std::string::npos;
|
||||||
|
}
|
||||||
|
|
||||||
CefRefPtr<CefRequestContext> CreateTestRequestContext(
|
CefRefPtr<CefRequestContext> CreateTestRequestContext(
|
||||||
TestRequestContextMode mode,
|
TestRequestContextMode mode,
|
||||||
const std::string& cache_path) {
|
const std::string& cache_path) {
|
||||||
|
@ -84,6 +84,9 @@ bool TestOldResourceAPI();
|
|||||||
// Returns true if the Chrome runtime is enabled.
|
// Returns true if the Chrome runtime is enabled.
|
||||||
bool IsChromeRuntimeEnabled();
|
bool IsChromeRuntimeEnabled();
|
||||||
|
|
||||||
|
// Returns true if requests for |url| should be ignored by tests.
|
||||||
|
bool IgnoreURL(const std::string& url);
|
||||||
|
|
||||||
// Return a RequestContext object matching the specified |mode|.
|
// Return a RequestContext object matching the specified |mode|.
|
||||||
// |cache_path| may be specified for CUSTOM modes.
|
// |cache_path| may be specified for CUSTOM modes.
|
||||||
// Use the RC_TEST_GROUP_BASE macro to test all valid combinations.
|
// Use the RC_TEST_GROUP_BASE macro to test all valid combinations.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user