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 23 matching lines...) Expand all Loading... |
34 #include "net/test/embedded_test_server/embedded_test_server.h" | 34 #include "net/test/embedded_test_server/embedded_test_server.h" |
35 #include "net/test/embedded_test_server/http_request.h" | 35 #include "net/test/embedded_test_server/http_request.h" |
36 #include "net/test/embedded_test_server/http_response.h" | 36 #include "net/test/embedded_test_server/http_response.h" |
37 #include "net/test/spawned_test_server/spawned_test_server.h" | 37 #include "net/test/spawned_test_server/spawned_test_server.h" |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 const char kTestCustomArg[] = "customArg"; | 41 const char kTestCustomArg[] = "customArg"; |
42 const char kTestDataDirectory[] = "testDataDirectory"; | 42 const char kTestDataDirectory[] = "testDataDirectory"; |
43 const char kTestWebSocketPort[] = "testWebSocketPort"; | 43 const char kTestWebSocketPort[] = "testWebSocketPort"; |
44 const char kIsolateExtensions[] = "isolateExtensions"; | |
45 const char kFtpServerPort[] = "ftpServer.port"; | 44 const char kFtpServerPort[] = "ftpServer.port"; |
46 const char kEmbeddedTestServerPort[] = "testServer.port"; | 45 const char kEmbeddedTestServerPort[] = "testServer.port"; |
47 | 46 |
48 std::unique_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest( | 47 std::unique_ptr<net::test_server::HttpResponse> HandleServerRedirectRequest( |
49 const net::test_server::HttpRequest& request) { | 48 const net::test_server::HttpRequest& request) { |
50 if (!base::StartsWith(request.relative_url, "/server-redirect?", | 49 if (!base::StartsWith(request.relative_url, "/server-redirect?", |
51 base::CompareCase::SENSITIVE)) | 50 base::CompareCase::SENSITIVE)) |
52 return nullptr; | 51 return nullptr; |
53 | 52 |
54 size_t query_string_pos = request.relative_url.find('?'); | 53 size_t query_string_pos = request.relative_url.find('?'); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 150 |
152 ExtensionApiTest::~ExtensionApiTest() {} | 151 ExtensionApiTest::~ExtensionApiTest() {} |
153 | 152 |
154 void ExtensionApiTest::SetUpOnMainThread() { | 153 void ExtensionApiTest::SetUpOnMainThread() { |
155 ExtensionBrowserTest::SetUpOnMainThread(); | 154 ExtensionBrowserTest::SetUpOnMainThread(); |
156 DCHECK(!test_config_.get()) << "Previous test did not clear config state."; | 155 DCHECK(!test_config_.get()) << "Previous test did not clear config state."; |
157 test_config_.reset(new base::DictionaryValue()); | 156 test_config_.reset(new base::DictionaryValue()); |
158 test_config_->SetString(kTestDataDirectory, | 157 test_config_->SetString(kTestDataDirectory, |
159 net::FilePathToFileURL(test_data_dir_).spec()); | 158 net::FilePathToFileURL(test_data_dir_).spec()); |
160 test_config_->SetInteger(kTestWebSocketPort, 0); | 159 test_config_->SetInteger(kTestWebSocketPort, 0); |
161 bool isolate_extensions = extensions::IsIsolateExtensionsEnabled(); | |
162 test_config_->SetBoolean(kIsolateExtensions, isolate_extensions); | |
163 extensions::TestGetConfigFunction::set_test_config_state( | 160 extensions::TestGetConfigFunction::set_test_config_state( |
164 test_config_.get()); | 161 test_config_.get()); |
165 } | 162 } |
166 | 163 |
167 void ExtensionApiTest::TearDownOnMainThread() { | 164 void ExtensionApiTest::TearDownOnMainThread() { |
168 ExtensionBrowserTest::TearDownOnMainThread(); | 165 ExtensionBrowserTest::TearDownOnMainThread(); |
169 extensions::TestGetConfigFunction::set_test_config_state(NULL); | 166 extensions::TestGetConfigFunction::set_test_config_state(NULL); |
170 test_config_.reset(NULL); | 167 test_config_.reset(NULL); |
171 } | 168 } |
172 | 169 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 } | 445 } |
449 | 446 |
450 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) { | 447 void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) { |
451 ExtensionBrowserTest::SetUpCommandLine(command_line); | 448 ExtensionBrowserTest::SetUpCommandLine(command_line); |
452 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 449 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
453 // Backgrounded renderer processes run at a lower priority, causing the | 450 // Backgrounded renderer processes run at a lower priority, causing the |
454 // 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 |
455 // tests don't time out. | 452 // tests don't time out. |
456 command_line->AppendSwitch(switches::kDisableRendererBackgrounding); | 453 command_line->AppendSwitch(switches::kDisableRendererBackgrounding); |
457 } | 454 } |
OLD | NEW |