本文整理汇总了C++中WebURLResponse::setMIMEType方法的典型用法代码示例。如果您正苦于以下问题:C++ WebURLResponse::setMIMEType方法的具体用法?C++ WebURLResponse::setMIMEType怎么用?C++ WebURLResponse::setMIMEType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebURLResponse
的用法示例。
在下文中一共展示了WebURLResponse::setMIMEType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: workerReadyForInspection
TEST_F(WebEmbeddedWorkerImplTest, ScriptNotFound)
{
WebURL scriptURL = URLTestHelpers::toKURL("https://www.example.com/sw-404.js");
WebURLResponse response;
response.initialize();
response.setMIMEType("text/javascript");
response.setHTTPStatusCode(404);
WebURLError error;
error.reason = 1010;
error.domain = "WebEmbeddedWorkerImplTest";
Platform::current()->unitTestSupport()->registerMockedErrorURL(scriptURL, response, error);
m_startData.scriptURL = scriptURL;
EXPECT_CALL(*m_mockClient, workerReadyForInspection())
.Times(1);
m_worker->startWorkerContext(m_startData);
::testing::Mock::VerifyAndClearExpectations(m_mockClient);
// Load the shadow page.
EXPECT_CALL(*m_mockClient, createServiceWorkerNetworkProvider(::testing::_))
.WillOnce(::testing::Return(nullptr));
Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
::testing::Mock::VerifyAndClearExpectations(m_mockClient);
// Load the script.
EXPECT_CALL(*m_mockClient, workerScriptLoaded())
.Times(0);
EXPECT_CALL(*m_mockClient, createServiceWorkerProvider())
.Times(0);
EXPECT_CALL(*m_mockClient, workerContextFailedToStart())
.Times(1);
Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
::testing::Mock::VerifyAndClearExpectations(m_mockClient);
}
示例2: RegisterMockedUrl
KURL RegisterMockedUrl(const std::string& urlRoot, const WTF::String& filename)
{
WebURLResponse response;
response.initialize();
response.setMIMEType("text/html");
WTF::String localPath = m_baseFilePath;
localPath.append(filename);
KURL url = toKURL(urlRoot + filename.utf8().data());
Platform::current()->unitTestSupport()->registerMockedURL(url, response, localPath);
return url;
}
示例3: registerErrorURL
void registerErrorURL(const char* file, int statusCode)
{
WebURLError error;
error.reason = 0xdead + statusCode;
error.domain = "PageSerializerTest";
WebURLResponse response;
response.initialize();
response.setMIMEType("text/html");
response.setHTTPStatusCode(statusCode);
Platform::current()->unitTestSupport()->registerMockedErrorURL(KURL(m_baseUrl, file), response, error);
}