Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: chrome/browser/extensions/api/management/management_api_browsertest.cc

Issue 501263002: Remove implicit conversions from scoped_refptr to T* in chrome/browser/extensions/api/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just in case Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/api/management/management_api.h" 9 #include "chrome/browser/extensions/api/management/management_api.h"
10 #include "chrome/browser/extensions/api/management/management_api_constants.h" 10 #include "chrome/browser/extensions/api/management/management_api_constants.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 test_data_dir_.AppendASCII("api_test/management/enabled_extension"), 1); 108 test_data_dir_.AppendASCII("api_test/management/enabled_extension"), 1);
109 ASSERT_TRUE(extension); 109 ASSERT_TRUE(extension);
110 110
111 const std::string id = extension->id(); 111 const std::string id = extension->id();
112 112
113 scoped_refptr<Extension> empty_extension( 113 scoped_refptr<Extension> empty_extension(
114 extension_function_test_utils::CreateEmptyExtension()); 114 extension_function_test_utils::CreateEmptyExtension());
115 // Uninstall, then cancel via the confirm dialog. 115 // Uninstall, then cancel via the confirm dialog.
116 scoped_refptr<ManagementUninstallFunction> uninstall_function( 116 scoped_refptr<ManagementUninstallFunction> uninstall_function(
117 new ManagementUninstallFunction()); 117 new ManagementUninstallFunction());
118 uninstall_function->set_extension(empty_extension); 118 uninstall_function->set_extension(empty_extension.get());
119 uninstall_function->set_user_gesture(true); 119 uninstall_function->set_user_gesture(true);
120 ManagementUninstallFunction::SetAutoConfirmForTest(false); 120 ManagementUninstallFunction::SetAutoConfirmForTest(false);
121 121
122 EXPECT_TRUE(MatchPattern( 122 EXPECT_TRUE(MatchPattern(
123 util::RunFunctionAndReturnError( 123 util::RunFunctionAndReturnError(
124 uninstall_function.get(), 124 uninstall_function.get(),
125 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", 125 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]",
126 id.c_str()), 126 id.c_str()),
127 browser()), 127 browser()),
128 keys::kUninstallCanceledError)); 128 keys::kUninstallCanceledError));
129 129
130 // Make sure the extension wasn't uninstalled. 130 // Make sure the extension wasn't uninstalled.
131 EXPECT_TRUE(service->GetExtensionById(id, false) != NULL); 131 EXPECT_TRUE(service->GetExtensionById(id, false) != NULL);
132 132
133 // Uninstall, then accept via the confirm dialog. 133 // Uninstall, then accept via the confirm dialog.
134 uninstall_function = new ManagementUninstallFunction(); 134 uninstall_function = new ManagementUninstallFunction();
135 uninstall_function->set_extension(empty_extension); 135 uninstall_function->set_extension(empty_extension.get());
136 ManagementUninstallFunction::SetAutoConfirmForTest(true); 136 ManagementUninstallFunction::SetAutoConfirmForTest(true);
137 uninstall_function->set_user_gesture(true); 137 uninstall_function->set_user_gesture(true);
138 util::RunFunctionAndReturnSingleResult( 138 util::RunFunctionAndReturnSingleResult(
139 uninstall_function.get(), 139 uninstall_function.get(),
140 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", id.c_str()), 140 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", id.c_str()),
141 browser()); 141 browser());
142 142
143 // Make sure the extension was uninstalled. 143 // Make sure the extension was uninstalled.
144 EXPECT_TRUE(service->GetExtensionById(id, false) == NULL); 144 EXPECT_TRUE(service->GetExtensionById(id, false) == NULL);
145 } 145 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // extension should be reloaded and enabled. 308 // extension should be reloaded and enabled.
309 ASSERT_TRUE(CrashEnabledExtension(kId)); 309 ASSERT_TRUE(CrashEnabledExtension(kId));
310 SetEnabled(false, true, std::string()); 310 SetEnabled(false, true, std::string());
311 SetEnabled(true, true, std::string()); 311 SetEnabled(true, true, std::string());
312 const Extension* extension = ExtensionSystem::Get(browser()->profile()) 312 const Extension* extension = ExtensionSystem::Get(browser()->profile())
313 ->extension_service()->GetExtensionById(kId, false); 313 ->extension_service()->GetExtensionById(kId, false);
314 EXPECT_TRUE(extension); 314 EXPECT_TRUE(extension);
315 } 315 }
316 316
317 } // namespace extensions 317 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698