| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/extensions/extensions_service.h" | 9 #include "chrome/browser/extensions/extensions_service.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| 11 #include "chrome/common/notification_registrar.h" | 11 #include "chrome/common/notification_registrar.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, | 75 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, |
| 76 const std::string& subtest_page) { | 76 const std::string& subtest_page) { |
| 77 ResultCatcher catcher; | 77 ResultCatcher catcher; |
| 78 LOG(INFO) << "Running ExtensionApiTest with: " << extension_name; | 78 LOG(INFO) << "Running ExtensionApiTest with: " << extension_name; |
| 79 | 79 |
| 80 if (!LoadExtension(test_data_dir_.AppendASCII(extension_name))) { | 80 if (!LoadExtension(test_data_dir_.AppendASCII(extension_name))) { |
| 81 message_ = "Failed to load extension."; | 81 message_ = "Failed to load extension."; |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // If there is a subtest to load, navigate to teh subtest page. | 85 // If there is a subtest to load, navigate to the subtest page. |
| 86 if (!subtest_page.empty()) { | 86 if (!subtest_page.empty()) { |
| 87 Extension* extension = GetSingleLoadedExtension(); | 87 Extension* extension = GetSingleLoadedExtension(); |
| 88 if (!extension) | 88 if (!extension) |
| 89 return false; // message_ was set by GetSingleLoadedExtension(). | 89 return false; // message_ was set by GetSingleLoadedExtension(). |
| 90 | 90 |
| 91 GURL url = extension->GetResourceURL(subtest_page); | 91 GURL url = extension->GetResourceURL(subtest_page); |
| 92 LOG(ERROR) << "Loading subtest page url: " << url.spec(); | 92 LOG(ERROR) << "Loading subtest page url: " << url.spec(); |
| 93 ui_test_utils::NavigateToURL(browser(), url); | 93 ui_test_utils::NavigateToURL(browser(), url); |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 message_ = "extension pointer is NULL."; | 127 message_ = "extension pointer is NULL."; |
| 128 return NULL; | 128 return NULL; |
| 129 } | 129 } |
| 130 return extension; | 130 return extension; |
| 131 } | 131 } |
| 132 | 132 |
| 133 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 133 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
| 134 ExtensionBrowserTest::SetUpCommandLine(command_line); | 134 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 135 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 135 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
| 136 } | 136 } |
| OLD | NEW |