| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/i18n/time_formatting.h" | 6 #include "base/i18n/time_formatting.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (!options_page.empty()) { | 208 if (!options_page.empty()) { |
| 209 input_value.SetString(extension_manifest_keys::kOptionsPage, | 209 input_value.SetString(extension_manifest_keys::kOptionsPage, |
| 210 options_page); | 210 options_page); |
| 211 } | 211 } |
| 212 std::string error; | 212 std::string error; |
| 213 scoped_refptr<Extension> extension = Extension::Create( | 213 scoped_refptr<Extension> extension = Extension::Create( |
| 214 full_path, location, input_value, Extension::STRICT_ERROR_CHECKS, | 214 full_path, location, input_value, Extension::STRICT_ERROR_CHECKS, |
| 215 &error); | 215 &error); |
| 216 ASSERT_TRUE(extension.get()); | 216 ASSERT_TRUE(extension.get()); |
| 217 EXPECT_STREQ("", error.c_str()); | 217 EXPECT_STREQ("", error.c_str()); |
| 218 browser()->GetProfile()->GetExtensionService()->AddExtension( | 218 browser()->GetProfile()->GetExtensionService()->OnLoadSingleExtension( |
| 219 extension.get()); | 219 extension.get()); |
| 220 | 220 |
| 221 // Makes sure that async task ExtensionPrefs::OnExtensionInstalled gets a | |
| 222 // chance to be procesed. | |
| 223 MessageLoop::current()->RunAllPending(); | |
| 224 | |
| 225 // Creates a panel with the app name that comes from the extension ID. | 221 // Creates a panel with the app name that comes from the extension ID. |
| 226 PanelBrowserView* browser_view = CreatePanelBrowserView( | 222 PanelBrowserView* browser_view = CreatePanelBrowserView( |
| 227 web_app::GenerateApplicationNameFromExtensionId(extension->id())); | 223 web_app::GenerateApplicationNameFromExtensionId(extension->id())); |
| 228 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); | 224 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); |
| 229 | 225 |
| 230 frame_view->EnsureSettingsMenuCreated(); | 226 frame_view->EnsureSettingsMenuCreated(); |
| 231 ASSERT_TRUE(frame_view->settings_menu_.get()); | 227 ASSERT_TRUE(frame_view->settings_menu_.get()); |
| 232 ASSERT_TRUE(frame_view->settings_menu_contents_.get()); | 228 ASSERT_TRUE(frame_view->settings_menu_contents_.get()); |
| 233 | 229 |
| 234 // Validates the settings menu items. | 230 // Validates the settings menu items. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 555 |
| 560 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreateSettingsMenu) { | 556 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, CreateSettingsMenu) { |
| 561 TestCreateSettingsMenuForExtension( | 557 TestCreateSettingsMenuForExtension( |
| 562 FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD, | 558 FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD, |
| 563 "", ""); | 559 "", ""); |
| 564 TestCreateSettingsMenuForExtension( | 560 TestCreateSettingsMenuForExtension( |
| 565 FILE_PATH_LITERAL("extension2"), Extension::INVALID, | 561 FILE_PATH_LITERAL("extension2"), Extension::INVALID, |
| 566 "http://home", "options.html"); | 562 "http://home", "options.html"); |
| 567 } | 563 } |
| 568 #endif | 564 #endif |
| OLD | NEW |