| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/strings/pattern.h" |
| 7 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 11 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 create_shortcut_function->set_user_gesture(true); | 123 create_shortcut_function->set_user_gesture(true); |
| 123 ManagementCreateAppShortcutFunction::SetAutoConfirmForTest(true); | 124 ManagementCreateAppShortcutFunction::SetAutoConfirmForTest(true); |
| 124 util::RunFunctionAndReturnSingleResult( | 125 util::RunFunctionAndReturnSingleResult( |
| 125 create_shortcut_function.get(), | 126 create_shortcut_function.get(), |
| 126 base::StringPrintf("[\"%s\"]", app_id.c_str()), | 127 base::StringPrintf("[\"%s\"]", app_id.c_str()), |
| 127 browser()); | 128 browser()); |
| 128 | 129 |
| 129 create_shortcut_function = new ManagementCreateAppShortcutFunction(); | 130 create_shortcut_function = new ManagementCreateAppShortcutFunction(); |
| 130 create_shortcut_function->set_user_gesture(true); | 131 create_shortcut_function->set_user_gesture(true); |
| 131 ManagementCreateAppShortcutFunction::SetAutoConfirmForTest(false); | 132 ManagementCreateAppShortcutFunction::SetAutoConfirmForTest(false); |
| 132 EXPECT_TRUE(MatchPattern( | 133 EXPECT_TRUE(base::MatchPattern( |
| 133 util::RunFunctionAndReturnError( | 134 util::RunFunctionAndReturnError( |
| 134 create_shortcut_function.get(), | 135 create_shortcut_function.get(), |
| 135 base::StringPrintf("[\"%s\"]", app_id.c_str()), | 136 base::StringPrintf("[\"%s\"]", app_id.c_str()), |
| 136 browser()), | 137 browser()), |
| 137 keys::kCreateShortcutCanceledError)); | 138 keys::kCreateShortcutCanceledError)); |
| 138 } | 139 } |
| 139 | 140 |
| 140 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, | 141 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, |
| 141 GetAllIncludesTerminated) { | 142 GetAllIncludesTerminated) { |
| 142 // Load an extension with a background page, so that we know it has a process | 143 // Load an extension with a background page, so that we know it has a process |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 SetEnabled(false, true, std::string()); | 285 SetEnabled(false, true, std::string()); |
| 285 SetEnabled(true, true, std::string()); | 286 SetEnabled(true, true, std::string()); |
| 286 const Extension* extension = ExtensionSystem::Get(browser()->profile()) | 287 const Extension* extension = ExtensionSystem::Get(browser()->profile()) |
| 287 ->extension_service() | 288 ->extension_service() |
| 288 ->GetExtensionById(kId, false); | 289 ->GetExtensionById(kId, false); |
| 289 EXPECT_TRUE(extension); | 290 EXPECT_TRUE(extension); |
| 290 } | 291 } |
| 291 } | 292 } |
| 292 | 293 |
| 293 } // namespace extensions | 294 } // namespace extensions |
| OLD | NEW |