| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // Base class for extension browser tests. Provides utilities for loading, | 33 // Base class for extension browser tests. Provides utilities for loading, |
| 34 // unloading, and installing extensions. | 34 // unloading, and installing extensions. |
| 35 void ExtensionBrowserTest::SetUpCommandLine(CommandLine* command_line) { | 35 void ExtensionBrowserTest::SetUpCommandLine(CommandLine* command_line) { |
| 36 // This enables DOM automation for tab contentses. | 36 // This enables DOM automation for tab contentses. |
| 37 EnableDOMAutomation(); | 37 EnableDOMAutomation(); |
| 38 | 38 |
| 39 // This enables it for extension hosts. | 39 // This enables it for extension hosts. |
| 40 ExtensionHost::EnableDOMAutomation(); | 40 ExtensionHost::EnableDOMAutomation(); |
| 41 | 41 |
| 42 command_line->AppendSwitch(switches::kEnableExtensions); | |
| 43 | |
| 44 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 42 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
| 45 test_data_dir_ = test_data_dir_.AppendASCII("extensions"); | 43 test_data_dir_ = test_data_dir_.AppendASCII("extensions"); |
| 46 } | 44 } |
| 47 | 45 |
| 48 bool ExtensionBrowserTest::LoadExtension(const FilePath& path) { | 46 bool ExtensionBrowserTest::LoadExtension(const FilePath& path) { |
| 49 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 47 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 50 size_t num_before = service->extensions()->size(); | 48 size_t num_before = service->extensions()->size(); |
| 51 { | 49 { |
| 52 NotificationRegistrar registrar; | 50 NotificationRegistrar registrar; |
| 53 registrar.Add(this, NotificationType::EXTENSION_LOADED, | 51 registrar.Add(this, NotificationType::EXTENSION_LOADED, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: | 183 case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: |
| 186 std::cout << "Got EXTENSION_HOST_DID_STOP_LOADING notification.\n"; | 184 std::cout << "Got EXTENSION_HOST_DID_STOP_LOADING notification.\n"; |
| 187 MessageLoopForUI::current()->Quit(); | 185 MessageLoopForUI::current()->Quit(); |
| 188 break; | 186 break; |
| 189 | 187 |
| 190 default: | 188 default: |
| 191 NOTREACHED(); | 189 NOTREACHED(); |
| 192 break; | 190 break; |
| 193 } | 191 } |
| 194 } | 192 } |
| OLD | NEW |