| 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()); |
| 87 | 90 |
| 88 // Count the number of non-component extensions. | 91 // Count the number of non-component extensions. |
| 89 int found_extensions = 0; | 92 int found_extensions = 0; |
| 90 for (size_t i = 0; i < service->extensions()->size(); i++) | 93 for (size_t i = 0; i < service->extensions()->size(); i++) |
| 91 if (service->extensions()->at(i)->location() != Extension::COMPONENT) | 94 if (service->extensions()->at(i)->location() != Extension::COMPONENT) |
| 92 found_extensions++; | 95 found_extensions++; |
| 93 | 96 |
| 94 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), | 97 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), |
| 95 static_cast<uint32>(found_extensions)); | 98 static_cast<uint32>(found_extensions)); |
| 96 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); | 99 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 .AppendASCII("Extensions") | 197 .AppendASCII("Extensions") |
| 195 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 198 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 196 .AppendASCII("1.0.0.0"); | 199 .AppendASCII("1.0.0.0"); |
| 197 } | 200 } |
| 198 }; | 201 }; |
| 199 | 202 |
| 200 IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Test) { | 203 IN_PROC_BROWSER_TEST_F(ExtensionsLoadTest, Test) { |
| 201 WaitForServicesToStart(1, false); | 204 WaitForServicesToStart(1, false); |
| 202 TestInjection(true, true); | 205 TestInjection(true, true); |
| 203 } | 206 } |
| OLD | NEW |