1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/test/browser_test_utils.h"
6 #include "net/base/net_util.h"
7 #include "xwalk/application/test/application_browsertest.h"
8 #include "xwalk/application/test/application_testapi.h"
10 using xwalk::application::Application;
12 class ApplicationTestApiTest : public ApplicationBrowserTest {
15 IN_PROC_BROWSER_TEST_F(ApplicationTestApiTest, TestApiTest) {
16 Application* app = application_sevice()->LaunchFromUnpackedPath(
17 test_data_dir_.Append(FILE_PATH_LITERAL("testapi")));
19 test_runner_->WaitForTestNotification();
20 EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::FAILURE);
22 test_runner_->PostResultToNotificationCallback();
23 test_runner_->WaitForTestNotification();
24 EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::PASS);
26 test_runner_->PostResultToNotificationCallback();
27 test_runner_->WaitForTestNotification();
28 EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::TIMEOUT);
30 // xwalk.app.test.runTest will notify pass when all tests are finished.
31 test_runner_->PostResultToNotificationCallback();
32 test_runner_->WaitForTestNotification();
33 EXPECT_EQ(test_runner_->GetTestsResult(), ApiTestRunner::PASS);