OLD | NEW |
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/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_test_api.h" | 10 #include "chrome/browser/extensions/extension_test_api.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/notification_service.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 const char kTestServerPort[] = "testServer.port"; | 20 const char kTestServerPort[] = "testServer.port"; |
20 | 21 |
21 }; // namespace | 22 }; // namespace |
22 | 23 |
23 ExtensionApiTest::ExtensionApiTest() {} | 24 ExtensionApiTest::ExtensionApiTest() {} |
24 | 25 |
25 ExtensionApiTest::~ExtensionApiTest() {} | 26 ExtensionApiTest::~ExtensionApiTest() {} |
26 | 27 |
27 ExtensionApiTest::ResultCatcher::ResultCatcher() | 28 ExtensionApiTest::ResultCatcher::ResultCatcher() |
28 : profile_restriction_(NULL), | 29 : profile_restriction_(NULL), |
29 waiting_(false) { | 30 waiting_(false) { |
30 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED, | 31 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED, |
31 NotificationService::AllSources()); | 32 content::NotificationService::AllSources()); |
32 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED, | 33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED, |
33 NotificationService::AllSources()); | 34 content::NotificationService::AllSources()); |
34 } | 35 } |
35 | 36 |
36 ExtensionApiTest::ResultCatcher::~ResultCatcher() { | 37 ExtensionApiTest::ResultCatcher::~ResultCatcher() { |
37 } | 38 } |
38 | 39 |
39 bool ExtensionApiTest::ResultCatcher::GetNextResult() { | 40 bool ExtensionApiTest::ResultCatcher::GetNextResult() { |
40 // Depending on the tests, multiple results can come in from a single call | 41 // Depending on the tests, multiple results can come in from a single call |
41 // to RunMessageLoop(), so we maintain a queue of results and just pull them | 42 // to RunMessageLoop(), so we maintain a queue of results and just pull them |
42 // off as the test calls this, going to the run loop only when the queue is | 43 // off as the test calls this, going to the run loop only when the queue is |
43 // empty. | 44 // empty. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 test_config_->SetInteger(kTestServerPort, | 238 test_config_->SetInteger(kTestServerPort, |
238 test_server()->host_port_pair().port()); | 239 test_server()->host_port_pair().port()); |
239 | 240 |
240 return true; | 241 return true; |
241 } | 242 } |
242 | 243 |
243 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 244 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
244 ExtensionBrowserTest::SetUpCommandLine(command_line); | 245 ExtensionBrowserTest::SetUpCommandLine(command_line); |
245 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 246 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
246 } | 247 } |
OLD | NEW |