#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
-#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/test_switches.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/infobars/core/infobar.h"
+#include "components/nacl/common/nacl_switches.h"
#include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
-#include "net/base/net_util.h"
+#include "net/base/filename_util.h"
#include "net/base/test_data_directory.h"
#include "ppapi/shared_impl/ppapi_switches.h"
#include "ui/gl/gl_switches.h"
const char library_name[] = "libppapi_tests.so";
#endif
-void AddPrivateSwitches(CommandLine* command_line) {
+void AddPrivateSwitches(base::CommandLine* command_line) {
// For TestRequestOSFileHandle.
command_line->AppendSwitch(switches::kUnlimitedStorage);
command_line->AppendSwitchASCII(switches::kAllowNaClFileHandleAPI,
return;
expecting_infobar_ = false;
- InfoBar* infobar = infobar_service->infobar_at(0);
+ infobars::InfoBar* infobar = infobar_service->infobar_at(0);
ConfirmInfoBarDelegate* delegate =
infobar->delegate()->AsConfirmInfoBarDelegate();
ASSERT_TRUE(delegate != NULL);
InProcessBrowserTest::SetUp();
}
-void PPAPITestBase::SetUpCommandLine(CommandLine* command_line) {
+void PPAPITestBase::SetUpCommandLine(base::CommandLine* command_line) {
// The test sends us the result via a cookie.
command_line->AppendSwitch(switches::kEnableFileCookies);
GURL::Replacements replacements;
std::string query = BuildQuery(std::string(), test_case);
- replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size()));
+ replacements.SetQuery(query.c_str(), url::Component(0, query.size()));
return test_url.ReplaceComponents(replacements);
}
void PPAPITestBase::RunTestURL(const GURL& test_url) {
#if defined(OS_WIN) && defined(USE_ASH)
// PPAPITests are broken in Ash browser tests (http://crbug.com/263548).
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshBrowserTests)) {
LOG(WARNING) << "PPAPITests are disabled for Ash browser tests.";
return;
}
// "PASS" or "FAIL"). This keeps us from timing out on waits for long tests.
PPAPITestMessageHandler handler;
JavascriptTestObserver observer(
- browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
+ browser()->tab_strip_model()->GetActiveWebContents(),
&handler);
ui_test_utils::NavigateToURL(browser(), test_url);
PPAPITest::PPAPITest() : in_process_(true) {
}
-void PPAPITest::SetUpCommandLine(CommandLine* command_line) {
+void PPAPITest::SetUpCommandLine(base::CommandLine* command_line) {
PPAPITestBase::SetUpCommandLine(command_line);
// Append the switch to register the pepper plugin.
return base::StringPrintf("%stestcase=%s", base.c_str(), test_case.c_str());
}
-void PPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) {
+void PPAPIPrivateTest::SetUpCommandLine(base::CommandLine* command_line) {
PPAPITest::SetUpCommandLine(command_line);
AddPrivateSwitches(command_line);
}
in_process_ = false;
}
-void OutOfProcessPPAPITest::SetUpCommandLine(CommandLine* command_line) {
+void OutOfProcessPPAPITest::SetUpCommandLine(base::CommandLine* command_line) {
PPAPITest::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
}
-void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(CommandLine* command_line) {
+void OutOfProcessPPAPIPrivateTest::SetUpCommandLine(
+ base::CommandLine* command_line) {
OutOfProcessPPAPITest::SetUpCommandLine(command_line);
AddPrivateSwitches(command_line);
}
-void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) {
+void PPAPINaClTest::SetUpCommandLine(base::CommandLine* command_line) {
+#if !defined(DISABLE_NACL)
PPAPITestBase::SetUpCommandLine(command_line);
- base::FilePath plugin_lib;
- EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib));
- EXPECT_TRUE(base::PathExists(plugin_lib));
-
// Enable running (non-portable) NaCl outside of the Chrome web store.
command_line->AppendSwitch(switches::kEnableNaCl);
command_line->AppendSwitchASCII(switches::kAllowNaClSocketAPI, "127.0.0.1");
command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
+#endif
+}
+
+void PPAPINaClTest::SetUpOnMainThread() {
+ base::FilePath plugin_lib;
+ EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib));
+ EXPECT_TRUE(base::PathExists(plugin_lib));
+}
+
+void PPAPINaClTest::RunTest(const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTest(test_case);
+#endif
+}
+
+void PPAPINaClTest::RunTestAndReload(const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTestAndReload(test_case);
+#endif
+}
+
+void PPAPINaClTest::RunTestViaHTTP(const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTestViaHTTP(test_case);
+#endif
+}
+
+void PPAPINaClTest::RunTestWithSSLServer(const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTestWithSSLServer(test_case);
+#endif
+}
+
+void PPAPINaClTest::RunTestWithWebSocketServer(const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTestWithWebSocketServer(test_case);
+#endif
+}
+
+void PPAPINaClTest::RunTestIfAudioOutputAvailable(
+ const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTestIfAudioOutputAvailable(test_case);
+#endif
+}
+
+void PPAPINaClTest::RunTestViaHTTPIfAudioOutputAvailable(
+ const std::string& test_case) {
+#if !defined(DISABLE_NACL)
+ PPAPITestBase::RunTestViaHTTPIfAudioOutputAvailable(test_case);
+#endif
}
// Append the correct mode and testcase string
test_case.c_str());
}
-void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(CommandLine* command_line) {
+void PPAPIPrivateNaClNewlibTest::SetUpCommandLine(
+ base::CommandLine* command_line) {
PPAPINaClNewlibTest::SetUpCommandLine(command_line);
AddPrivateSwitches(command_line);
}
test_case.c_str());
}
-void PPAPIPrivateNaClGLibcTest::SetUpCommandLine(CommandLine* command_line) {
+void PPAPIPrivateNaClGLibcTest::SetUpCommandLine(
+ base::CommandLine* command_line) {
PPAPINaClGLibcTest::SetUpCommandLine(command_line);
AddPrivateSwitches(command_line);
}
test_case.c_str());
}
-void PPAPIPrivateNaClPNaClTest::SetUpCommandLine(CommandLine* command_line) {
+void PPAPIPrivateNaClPNaClTest::SetUpCommandLine(
+ base::CommandLine* command_line) {
PPAPINaClPNaClTest::SetUpCommandLine(command_line);
AddPrivateSwitches(command_line);
}
+void PPAPINaClPNaClNonSfiTest::SetUpCommandLine(
+ base::CommandLine* command_line) {
+ PPAPINaClTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(switches::kEnableNaClNonSfiMode);
+}
+
+std::string PPAPINaClPNaClNonSfiTest::BuildQuery(
+ const std::string& base,
+ const std::string& test_case) {
+ return base::StringPrintf("%smode=nacl_pnacl_nonsfi&testcase=%s",
+ base.c_str(), test_case.c_str());
+}
+
+void PPAPIPrivateNaClPNaClNonSfiTest::SetUpCommandLine(
+ base::CommandLine* command_line) {
+ PPAPINaClPNaClNonSfiTest::SetUpCommandLine(command_line);
+ AddPrivateSwitches(command_line);
+}
+
void PPAPINaClTestDisallowedSockets::SetUpCommandLine(
- CommandLine* command_line) {
+ base::CommandLine* command_line) {
PPAPITestBase::SetUpCommandLine(command_line);
- base::FilePath plugin_lib;
- EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib));
- EXPECT_TRUE(base::PathExists(plugin_lib));
-
// Enable running (non-portable) NaCl outside of the Chrome web store.
command_line->AppendSwitch(switches::kEnableNaCl);
}
void PPAPIBrokerInfoBarTest::SetUpOnMainThread() {
// The default content setting for the PPAPI broker is ASK. We purposefully
// don't call PPAPITestBase::SetUpOnMainThread() to keep it that way.
+
+ base::FilePath plugin_lib;
+ EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib));
+ EXPECT_TRUE(base::PathExists(plugin_lib));
}