#include "content/public/test/test_utils.h"
using xwalk::extensions::XWalkExtensionService;
+using xwalk::Runtime;
class ExternalExtensionTest : public XWalkExtensionsTestBase {
public:
};
IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, NavigateWithExternalExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(base::FilePath(),
base::FilePath().AppendASCII("echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
for (int i = 0; i < 5; i++) {
- xwalk_test_utils::NavigateToURL(runtime(), url);
- WaitForLoadStop(runtime()->web_contents());
+ xwalk_test_utils::NavigateToURL(runtime, url);
+ WaitForLoadStop(runtime->web_contents());
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
}
IN_PROC_BROWSER_TEST_F(ExternalExtensionTest, ExternalExtensionSync) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("sync_echo.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(RuntimeInterfaceTest, GetRuntimeVariable) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("get_runtime_variable.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, MultipleEntryPoints) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("entry_points.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, SetterLoadsExtension) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII("setter_callback_entry_point.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}
IN_PROC_BROWSER_TEST_F(MultipleEntryPointsExtension, ReplacementObjectIsUsed) {
- content::RunAllPendingInMessageLoop();
+ Runtime* runtime = CreateRuntime();
GURL url = GetExtensionsTestURL(
base::FilePath(),
base::FilePath().AppendASCII(
"lazy_loaded_extension_overrides_object.html"));
- content::TitleWatcher title_watcher(runtime()->web_contents(), kPassString);
+ content::TitleWatcher title_watcher(runtime->web_contents(), kPassString);
title_watcher.AlsoWaitForTitle(kFailString);
- xwalk_test_utils::NavigateToURL(runtime(), url);
+ xwalk_test_utils::NavigateToURL(runtime, url);
EXPECT_EQ(kPassString, title_watcher.WaitAndGetTitle());
}