Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: chrome/test/ui/named_interface_uitest.cc

Issue 7523060: Let pyauto create an attached webdriver instance to manipulate web pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move bools into struct Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/test_switches.h" 10 #include "chrome/test/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 CommandLine::StringType channel_path =
25 CommandLine::ForCurrentProcess()->GetSwitchValueNative( 25 CommandLine::ForCurrentProcess()->GetSwitchValueNative(
26 switches::kTestingChannel); 26 switches::kTestingChannel);
27 if (channel_path.empty()) 27 if (channel_path.empty())
28 channel_path = ProxyLauncher::kDefaultInterfacePath; 28 channel_path = ProxyLauncher::kDefaultInterfacePath;
29 29
30 return new NamedProxyLauncher(channel_path, true, true); 30 NamedProxyLauncher::InitParams params;
31 params.launch_browser = true;
32 params.disconnect_on_failure = true;
33 params.wait_for_server_channel = true;
34 return new NamedProxyLauncher(channel_path, params);
31 } 35 }
32 }; 36 };
33 37
34 // Basic sanity test for named testing interface which 38 // Basic sanity test for named testing interface which
35 // launches a browser instance that uses a named socket, then 39 // launches a browser instance that uses a named socket, then
36 // sends it some commands to open some tabs over that socket. 40 // sends it some commands to open some tabs over that socket.
37 TEST_F(NamedInterfaceTest, BasicNamedInterface) { 41 TEST_F(NamedInterfaceTest, BasicNamedInterface) {
38 scoped_refptr<BrowserProxy> browser_proxy( 42 scoped_refptr<BrowserProxy> browser_proxy(
39 automation()->GetBrowserWindow(0)); 43 automation()->GetBrowserWindow(0));
40 ASSERT_TRUE(browser_proxy.get()); 44 ASSERT_TRUE(browser_proxy.get());
41 45
42 for (int i = 0; i < 10; ++i) 46 for (int i = 0; i < 10; ++i)
43 ASSERT_TRUE(browser_proxy->AppendTab(GURL(chrome::kAboutBlankURL))); 47 ASSERT_TRUE(browser_proxy->AppendTab(GURL(chrome::kAboutBlankURL)));
44 } 48 }
45 49
46 // TODO(dtu): crosbug.com/8514: Write a test that makes sure you can disconnect, 50 // TODO(dtu): crosbug.com/8514: Write a test that makes sure you can disconnect,
47 // then reconnect with a new connection and continue automation. 51 // then reconnect with a new connection and continue automation.
48 52
49 } // namespace 53 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698