OLD | NEW |
---|---|
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/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 embedded_test_server()->RegisterRequestHandler( | 144 embedded_test_server()->RegisterRequestHandler( |
145 base::Bind(&HandleEchoHeaderRequest)); | 145 base::Bind(&HandleEchoHeaderRequest)); |
146 embedded_test_server()->RegisterRequestHandler( | 146 embedded_test_server()->RegisterRequestHandler( |
147 base::Bind(&HandleSetCookieRequest)); | 147 base::Bind(&HandleSetCookieRequest)); |
148 embedded_test_server()->RegisterRequestHandler( | 148 embedded_test_server()->RegisterRequestHandler( |
149 base::Bind(&HandleSetHeaderRequest)); | 149 base::Bind(&HandleSetHeaderRequest)); |
150 } | 150 } |
151 | 151 |
152 ExtensionApiTest::~ExtensionApiTest() {} | 152 ExtensionApiTest::~ExtensionApiTest() {} |
153 | 153 |
154 void ExtensionApiTest::SetUpInProcessBrowserTestFixture() { | 154 void ExtensionApiTest::SetUpOnMainThread() { |
155 ExtensionBrowserTest::SetUpOnMainThread(); | |
155 DCHECK(!test_config_.get()) << "Previous test did not clear config state."; | 156 DCHECK(!test_config_.get()) << "Previous test did not clear config state."; |
156 test_config_.reset(new base::DictionaryValue()); | 157 test_config_.reset(new base::DictionaryValue()); |
157 test_config_->SetString(kTestDataDirectory, | 158 test_config_->SetString(kTestDataDirectory, |
158 net::FilePathToFileURL(test_data_dir_).spec()); | 159 net::FilePathToFileURL(test_data_dir_).spec()); |
159 test_config_->SetInteger(kTestWebSocketPort, 0); | 160 test_config_->SetInteger(kTestWebSocketPort, 0); |
160 bool isolate_extensions = extensions::IsIsolateExtensionsEnabled(); | 161 bool isolate_extensions = extensions::IsIsolateExtensionsEnabled(); |
161 test_config_->SetBoolean(kIsolateExtensions, isolate_extensions); | 162 test_config_->SetBoolean(kIsolateExtensions, isolate_extensions); |
162 extensions::TestGetConfigFunction::set_test_config_state( | 163 extensions::TestGetConfigFunction::set_test_config_state( |
163 test_config_.get()); | 164 test_config_.get()); |
164 } | 165 } |
165 | 166 |
166 void ExtensionApiTest::TearDownInProcessBrowserTestFixture() { | 167 void ExtensionApiTest::TearDownInProcessBrowserTestFixture() { |
Devlin
2017/02/14 23:37:46
For symmetry's sake, let's make this TearDownOnMai
nasko
2017/02/15 19:20:24
Done.
| |
167 extensions::TestGetConfigFunction::set_test_config_state(NULL); | 168 extensions::TestGetConfigFunction::set_test_config_state(NULL); |
168 test_config_.reset(NULL); | 169 test_config_.reset(NULL); |
169 } | 170 } |
170 | 171 |
171 bool ExtensionApiTest::RunExtensionTest(const std::string& extension_name) { | 172 bool ExtensionApiTest::RunExtensionTest(const std::string& extension_name) { |
172 return RunExtensionTestImpl( | 173 return RunExtensionTestImpl( |
173 extension_name, std::string(), NULL, kFlagEnableFileAccess); | 174 extension_name, std::string(), NULL, kFlagEnableFileAccess); |
174 } | 175 } |
175 | 176 |
176 bool ExtensionApiTest::RunExtensionTestWithArg( | 177 bool ExtensionApiTest::RunExtensionTestWithArg( |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 } | 445 } |
445 | 446 |
446 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) { | 447 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) { |
447 ExtensionBrowserTest::SetUpCommandLine(command_line); | 448 ExtensionBrowserTest::SetUpCommandLine(command_line); |
448 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 449 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
449 // Backgrounded renderer processes run at a lower priority, causing the | 450 // Backgrounded renderer processes run at a lower priority, causing the |
450 // tests to take more time to complete. Disable backgrounding so that the | 451 // tests to take more time to complete. Disable backgrounding so that the |
451 // tests don't time out. | 452 // tests don't time out. |
452 command_line->AppendSwitch(switches::kDisableRendererBackgrounding); | 453 command_line->AppendSwitch(switches::kDisableRendererBackgrounding); |
453 } | 454 } |
OLD | NEW |