| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 EXPECT_TRUE(file_util::Delete(preferences_file_, false)); | 77 EXPECT_TRUE(file_util::Delete(preferences_file_, false)); |
| 78 | 78 |
| 79 // TODO(phajdan.jr): Check return values of the functions below, carefully. | 79 // TODO(phajdan.jr): Check return values of the functions below, carefully. |
| 80 file_util::Delete(user_scripts_dir_, true); | 80 file_util::Delete(user_scripts_dir_, true); |
| 81 file_util::Delete(extensions_dir_, true); | 81 file_util::Delete(extensions_dir_, true); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void WaitForServicesToStart(int num_expected_extensions, | 84 void WaitForServicesToStart(int num_expected_extensions, |
| 85 bool expect_extensions_enabled) { | 85 bool expect_extensions_enabled) { |
| 86 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 86 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 87 if (!service->is_ready()) | |
| 88 ui_test_utils::WaitForNotification(NotificationType::EXTENSIONS_READY); | |
| 89 ASSERT_TRUE(service->is_ready()); | |
| 90 | 87 |
| 91 // Count the number of non-component extensions. | 88 // Count the number of non-component extensions. |
| 92 int found_extensions = 0; | 89 int found_extensions = 0; |
| 93 for (size_t i = 0; i < service->extensions()->size(); i++) | 90 for (size_t i = 0; i < service->extensions()->size(); i++) |
| 94 if (service->extensions()->at(i)->location() != Extension::COMPONENT) | 91 if (service->extensions()->at(i)->location() != Extension::COMPONENT) |
| 95 found_extensions++; | 92 found_extensions++; |
| 96 | 93 |
| 97 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), | 94 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), |
| 98 static_cast<uint32>(found_extensions)); | 95 static_cast<uint32>(found_extensions)); |
| 99 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); | 96 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 .AppendASCII("Extensions") | 194 .AppendASCII("Extensions") |
| 198 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 195 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 199 .AppendASCII("1.0.0.0"); | 196 .AppendASCII("1.0.0.0"); |
| 200 } | 197 } |
| 201 }; | 198 }; |
| 202 | 199 |
| 203 IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Test) { | 200 IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Test) { |
| 204 WaitForServicesToStart(1, false); | 201 WaitForServicesToStart(1, false); |
| 205 TestInjection(true, true); | 202 TestInjection(true, true); |
| 206 } | 203 } |
| OLD | NEW |