OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
6 | 6 |
7 #include "chrome/common/url_constants.h" | 7 #include "chrome/common/url_constants.h" |
8 #include "chrome/test/automation/automation_proxy.h" | 8 #include "chrome/test/automation/automation_proxy.h" |
9 #include "chrome/test/automation/proxy_launcher.h" | 9 #include "chrome/test/automation/proxy_launcher.h" |
10 #include "chrome/test/base/test_switches.h" | 10 #include "chrome/test/base/test_switches.h" |
11 | 11 |
12 // The named testing interface enables the use of a named socket for controlling | 12 // The named testing interface enables the use of a named socket for controlling |
13 // the browser. This eliminates the dependency that the browser must be forked | 13 // the browser. This eliminates the dependency that the browser must be forked |
14 // from the controlling process. | 14 // from the controlling process. |
15 namespace { | 15 namespace { |
16 | 16 |
17 class NamedInterfaceTest : public UITest { | 17 class NamedInterfaceTest : public UITest { |
18 public: | 18 public: |
19 NamedInterfaceTest() { | 19 NamedInterfaceTest() { |
20 show_window_ = true; | 20 show_window_ = true; |
21 } | 21 } |
22 | 22 |
23 virtual ProxyLauncher *CreateProxyLauncher() { | 23 virtual ProxyLauncher *CreateProxyLauncher() { |
24 CommandLine::StringType channel_path = | 24 std::string channel_id = |
25 CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 25 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
26 switches::kTestingChannel); | 26 switches::kTestingChannel); |
27 if (channel_path.empty()) | 27 if (channel_id.empty()) |
28 channel_path = ProxyLauncher::kDefaultInterfacePath; | 28 channel_id = ProxyLauncher::kDefaultInterfaceId; |
29 | 29 |
30 return new NamedProxyLauncher(channel_path, true, true); | 30 return new NamedProxyLauncher(channel_id, true, true); |
31 } | 31 } |
32 }; | 32 }; |
33 | 33 |
34 // Basic sanity test for named testing interface which | 34 // Basic sanity test for named testing interface which |
35 // launches a browser instance that uses a named socket, then | 35 // launches a browser instance that uses a named socket, then |
36 // sends it some commands to open some tabs over that socket. | 36 // sends it some commands to open some tabs over that socket. |
37 TEST_F(NamedInterfaceTest, BasicNamedInterface) { | 37 TEST_F(NamedInterfaceTest, BasicNamedInterface) { |
38 scoped_refptr<BrowserProxy> browser_proxy( | 38 scoped_refptr<BrowserProxy> browser_proxy( |
39 automation()->GetBrowserWindow(0)); | 39 automation()->GetBrowserWindow(0)); |
40 ASSERT_TRUE(browser_proxy.get()); | 40 ASSERT_TRUE(browser_proxy.get()); |
41 | 41 |
42 for (int i = 0; i < 10; ++i) | 42 for (int i = 0; i < 10; ++i) |
43 ASSERT_TRUE(browser_proxy->AppendTab(GURL(chrome::kAboutBlankURL))); | 43 ASSERT_TRUE(browser_proxy->AppendTab(GURL(chrome::kAboutBlankURL))); |
44 } | 44 } |
45 | 45 |
46 // TODO(dtu): crosbug.com/8514: Write a test that makes sure you can disconnect, | 46 // TODO(dtu): crosbug.com/8514: Write a test that makes sure you can disconnect, |
47 // then reconnect with a new connection and continue automation. | 47 // then reconnect with a new connection and continue automation. |
48 | 48 |
49 } // namespace | 49 } // namespace |
OLD | NEW |