This source file includes following definitions.
- SetUpCommandLine
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "base/command_line.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
namespace content {
class SiteIsolationPolicyBrowserTest : public ContentBrowserTest {
public:
SiteIsolationPolicyBrowserTest() {}
virtual ~SiteIsolationPolicyBrowserTest() {}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
ASSERT_TRUE(test_server()->Start());
net::SpawnedTestServer https_server(
net::SpawnedTestServer::TYPE_HTTPS,
net::SpawnedTestServer::kLocalhost,
base::FilePath(FILE_PATH_LITERAL("content/test/data")));
ASSERT_TRUE(https_server.Start());
command_line->AppendSwitchASCII(
switches::kHostResolverRules,
"MAP * " + test_server()->host_port_pair().ToString() +
",EXCLUDE localhost");
command_line->AppendSwitch(switches::kDisableWebSecurity);
command_line->AppendSwitch(switches::kBlockCrossSiteDocuments);
}
private:
DISALLOW_COPY_AND_ASSIGN(SiteIsolationPolicyBrowserTest);
};
#if defined(OS_ANDROID)
#define MAYBE_CrossSiteDocumentBlockingForMimeType \
DISABLED_CrossSiteDocumentBlockingForMimeType
#else
#define MAYBE_CrossSiteDocumentBlockingForMimeType \
CrossSiteDocumentBlockingForMimeType
#endif
IN_PROC_BROWSER_TEST_F(SiteIsolationPolicyBrowserTest,
MAYBE_CrossSiteDocumentBlockingForMimeType) {
GURL foo("http://foo.com/files/cross_site_document_request.html");
content::DOMMessageQueue msg_queue;
NavigateToURL(shell(), foo);
std::string status;
std::string expected_status("1");
EXPECT_TRUE(msg_queue.WaitForMessage(&status));
EXPECT_STREQ(status.c_str(), expected_status.c_str());
}
#if defined(OS_ANDROID)
#define MAYBE_CrossSiteDocumentBlockingForDifferentTargets \
DISABLED_CrossSiteDocumentBlockingForDifferentTargets
#else
#define MAYBE_CrossSiteDocumentBlockingForDifferentTargets \
CrossSiteDocumentBlockingForDifferentTargets
#endif
IN_PROC_BROWSER_TEST_F(SiteIsolationPolicyBrowserTest,
MAYBE_CrossSiteDocumentBlockingForDifferentTargets) {
GURL foo("http://foo.com/files/cross_site_document_request_target.html");
NavigateToURL(shell(), foo);
}
}