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

Side by Side Diff: content/test/browser_test_base.cc

Issue 8402016: set user agent for content browser tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/test/browser_test_base.h" 5 #include "content/test/browser_test_base.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "content/common/main_function_params.h" 9 #include "content/common/main_function_params.h"
10 #include "sandbox/src/dep.h" 10 #include "sandbox/src/dep.h"
11 #include "webkit/glue/user_agent.h"
12 #include "webkit/glue/webkit_glue.h"
11 13
12 #if defined(OS_MACOSX) 14 #if defined(OS_MACOSX)
13 #include "base/mac/mac_util.h" 15 #include "base/mac/mac_util.h"
14 #include "base/system_monitor/system_monitor.h" 16 #include "base/system_monitor/system_monitor.h"
15 #endif 17 #endif
16 18
17 extern int BrowserMain(const MainFunctionParams&); 19 extern int BrowserMain(const MainFunctionParams&);
18 20
19 BrowserTestBase::BrowserTestBase() { 21 BrowserTestBase::BrowserTestBase() {
20 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX)
21 base::mac::SetOverrideAmIBundled(true); 23 base::mac::SetOverrideAmIBundled(true);
22 base::SystemMonitor::AllocateSystemIOPorts(); 24 base::SystemMonitor::AllocateSystemIOPorts();
23 #endif 25 #endif
24 } 26 }
25 27
26 BrowserTestBase::~BrowserTestBase() { 28 BrowserTestBase::~BrowserTestBase() {
27 } 29 }
28 30
29 void BrowserTestBase::SetUp() { 31 void BrowserTestBase::SetUp() {
30 SandboxInitWrapper sandbox_wrapper; 32 SandboxInitWrapper sandbox_wrapper;
31 MainFunctionParams params(*CommandLine::ForCurrentProcess(), 33 MainFunctionParams params(*CommandLine::ForCurrentProcess(),
32 sandbox_wrapper, 34 sandbox_wrapper,
33 NULL); 35 NULL);
34 params.ui_task = 36 params.ui_task =
35 NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop); 37 NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop);
36 38
39 std::string product("Chrome/15.16.17.18");
Paweł Hajdan Jr. 2011/10/27 08:48:52 Why not 0.0.0.0 as for DRT? Chrome/15 might sugges
40 webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct(product),
Paweł Hajdan Jr. 2011/10/27 08:48:52 I don't like it anyway. We're calling BrowserMain,
41 false);
37 SetUpInProcessBrowserTestFixture(); 42 SetUpInProcessBrowserTestFixture();
38 BrowserMain(params); 43 BrowserMain(params);
39 TearDownInProcessBrowserTestFixture(); 44 TearDownInProcessBrowserTestFixture();
40 } 45 }
41 46
42 void BrowserTestBase::TearDown() { 47 void BrowserTestBase::TearDown() {
43 } 48 }
44 49
45 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { 50 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
46 RunTestOnMainThreadLoop(); 51 RunTestOnMainThreadLoop();
47 } 52 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698