Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / xwalk / sysapps / device_capabilities / device_capabilities_api_browsertest.cc
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.
4
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"
13
14 IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, SysAppsDeviceCapabilities) {
15   const base::string16 passString = base::ASCIIToUTF16("Pass");
16   const base::string16 failString = base::ASCIIToUTF16("Fail");
17
18   content::RunAllPendingInMessageLoop();
19   content::TitleWatcher title_watcher(runtime()->web_contents(), passString);
20   title_watcher.AlsoWaitForTitle(failString);
21
22   base::FilePath test_file;
23   PathService::Get(base::DIR_SOURCE_ROOT, &test_file);
24   test_file = 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"));
29
30   xwalk_test_utils::NavigateToURL(runtime(), net::FilePathToFileURL(test_file));
31   EXPECT_EQ(passString, title_watcher.WaitAndGetTitle());
32 }