Upstream version 11.39.256.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / devtools / xwalk_devtools_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/command_line.h"
6 #include "base/strings/utf_string_conversions.h"
7 #include "xwalk/runtime/browser/runtime.h"
8 #include "xwalk/test/base/in_process_browser_test.h"
9 #include "xwalk/test/base/xwalk_test_utils.h"
10 #include "content/public/common/content_switches.h"
11 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/test/browser_test_utils.h"
13 #include "content/public/test/test_utils.h"
14 #include "content/public/browser/web_contents.h"
15 #include "net/base/net_util.h"
16 #include "testing/gmock/include/gmock/gmock.h"
17
18 using xwalk::Runtime;
19
20 class XWalkDevToolsTest : public InProcessBrowserTest {
21  public:
22   XWalkDevToolsTest() {}
23   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
24     command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, "9222");
25     GURL url = xwalk_test_utils::GetTestURL(
26       base::FilePath(), base::FilePath().AppendASCII("test.html"));
27     command_line->AppendArg(url.spec());
28   }
29 };
30
31 IN_PROC_BROWSER_TEST_F(XWalkDevToolsTest, RemoteDebugging) {
32   GURL localhost_url("http://127.0.0.1:9222");
33   Runtime* debugging_host = CreateRuntime(localhost_url);
34   content::WaitForLoadStop(debugging_host->web_contents());
35   base::string16 real_title = debugging_host->web_contents()->GetTitle();
36   base::string16 expected_title = base::ASCIIToUTF16("XWalk Remote Debugging");
37   EXPECT_EQ(expected_title, real_title);
38 }