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 "base/path_service.h"
6 #include "base/strings/utf_string_conversions.h"
7 #include "content/public/test/browser_test_utils.h"
8 #include "content/public/test/test_utils.h"
9 #include "net/base/filename_util.h"
10 #include "xwalk/runtime/browser/runtime.h"
11 #include "xwalk/test/base/in_process_browser_test.h"
12 #include "xwalk/test/base/xwalk_test_utils.h"
14 IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, SysAppsDeviceCapabilities) {
15 const base::string16 passString = base::ASCIIToUTF16("Pass");
16 const base::string16 failString = base::ASCIIToUTF16("Fail");
18 content::RunAllPendingInMessageLoop();
19 content::TitleWatcher title_watcher(runtime()->web_contents(), passString);
20 title_watcher.AlsoWaitForTitle(failString);
22 base::FilePath test_file;
23 PathService::Get(base::DIR_SOURCE_ROOT, &test_file);
25 .Append(FILE_PATH_LITERAL("xwalk"))
26 .Append(FILE_PATH_LITERAL("sysapps"))
27 .Append(FILE_PATH_LITERAL("device_capabilities"))
28 .Append(FILE_PATH_LITERAL("device_capabilities_api_browsertest.html"));
30 xwalk_test_utils::NavigateToURL(runtime(), net::FilePathToFileURL(test_file));
31 EXPECT_EQ(passString, title_watcher.WaitAndGetTitle());