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

Side by Side Diff: chrome/test/base/chrome_test_suite.cc

Issue 9623027: Move --user-agent overriding logic from chrome into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: replace SetContentClient() with Initialize() Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/chrome_test_suite.h" 5 #include "chrome/test/base/chrome_test_suite.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/metrics/stats_table.h" 10 #include "base/metrics/stats_table.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener { 97 class ChromeTestSuiteInitializer : public testing::EmptyTestEventListener {
98 public: 98 public:
99 ChromeTestSuiteInitializer() { 99 ChromeTestSuiteInitializer() {
100 } 100 }
101 101
102 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { 102 virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
103 DCHECK(!g_browser_process); 103 DCHECK(!g_browser_process);
104 g_browser_process = new TestingBrowserProcess; 104 g_browser_process = new TestingBrowserProcess;
105 105
106 DCHECK(!content::GetContentClient());
107 content_client_.reset(new chrome::ChromeContentClient); 106 content_client_.reset(new chrome::ChromeContentClient);
108 browser_content_client_.reset(new chrome::ChromeContentBrowserClient()); 107 browser_content_client_.reset(new chrome::ChromeContentBrowserClient());
109 content_client_->set_browser(browser_content_client_.get()); 108 content_client_->set_browser(browser_content_client_.get());
110 content::SetContentClient(content_client_.get()); 109 // NOTE: this means we're no longer using the "offical" UA string for these
110 // tests -- is that an issue?
111 content::Initialize(content_client_.get(), "ChromeTestSuite");
scherkus (not reviewing) 2012/04/05 23:20:45 FYI
Dirk Pranke 2012/04/05 23:35:54 It "shouldn't" be an issue, but it may be that the
111 112
112 SetUpHostResolver(); 113 SetUpHostResolver();
113 } 114 }
114 115
115 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { 116 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
116 if (g_browser_process) { 117 if (g_browser_process) {
117 delete g_browser_process; 118 delete g_browser_process;
118 g_browser_process = NULL; 119 g_browser_process = NULL;
119 } 120 }
120 121
121 DCHECK_EQ(content_client_.get(), content::GetContentClient()); 122 DCHECK_EQ(content_client_.get(), content::GetContentClient());
122 browser_content_client_.reset(); 123 browser_content_client_.reset();
123 content_client_.reset(); 124 content_client_.reset();
124 content::SetContentClient(NULL); 125 content::Uninitialize();
125 126
126 TearDownHostResolver(); 127 TearDownHostResolver();
127 } 128 }
128 129
129 private: 130 private:
130 void SetUpHostResolver() { 131 void SetUpHostResolver() {
131 host_resolver_proc_ = new LocalHostResolverProc; 132 host_resolver_proc_ = new LocalHostResolverProc;
132 scoped_host_resolver_proc_.reset( 133 scoped_host_resolver_proc_.reset(
133 new net::ScopedDefaultHostResolverProc(host_resolver_proc_.get())); 134 new net::ScopedDefaultHostResolverProc(host_resolver_proc_.get()));
134 } 135 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 #if defined(OS_MACOSX) 215 #if defined(OS_MACOSX)
215 base::mac::SetOverrideFrameworkBundle(NULL); 216 base::mac::SetOverrideFrameworkBundle(NULL);
216 #endif 217 #endif
217 218
218 base::StatsTable::set_current(NULL); 219 base::StatsTable::set_current(NULL);
219 stats_table_.reset(); 220 stats_table_.reset();
220 RemoveSharedMemoryFile(stats_filename_); 221 RemoveSharedMemoryFile(stats_filename_);
221 222
222 base::TestSuite::Shutdown(); 223 base::TestSuite::Shutdown();
223 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698