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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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/pattern.h" 7 #include "base/strings/pattern.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // running. 149 // running.
150 ExtensionTestMessageListener listener("ready", false); 150 ExtensionTestMessageListener listener("ready", false);
151 const Extension* extension = LoadExtension( 151 const Extension* extension = LoadExtension(
152 test_data_dir_.AppendASCII("management/install_event")); 152 test_data_dir_.AppendASCII("management/install_event"));
153 ASSERT_TRUE(extension); 153 ASSERT_TRUE(extension);
154 ASSERT_TRUE(listener.WaitUntilSatisfied()); 154 ASSERT_TRUE(listener.WaitUntilSatisfied());
155 155
156 // The management API should list this extension. 156 // The management API should list this extension.
157 scoped_refptr<ManagementGetAllFunction> function = 157 scoped_refptr<ManagementGetAllFunction> function =
158 new ManagementGetAllFunction(); 158 new ManagementGetAllFunction();
159 scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( 159 std::unique_ptr<base::Value> result(
160 function.get(), "[]", browser())); 160 util::RunFunctionAndReturnSingleResult(function.get(), "[]", browser()));
161 base::ListValue* list; 161 base::ListValue* list;
162 ASSERT_TRUE(result->GetAsList(&list)); 162 ASSERT_TRUE(result->GetAsList(&list));
163 EXPECT_EQ(1U, list->GetSize()); 163 EXPECT_EQ(1U, list->GetSize());
164 164
165 // And it should continue to do so even after it crashes. 165 // And it should continue to do so even after it crashes.
166 ASSERT_TRUE(CrashEnabledExtension(extension->id())); 166 ASSERT_TRUE(CrashEnabledExtension(extension->id()));
167 167
168 function = new ManagementGetAllFunction(); 168 function = new ManagementGetAllFunction();
169 result.reset(util::RunFunctionAndReturnSingleResult( 169 result.reset(util::RunFunctionAndReturnSingleResult(
170 function.get(), "[]", browser())); 170 function.get(), "[]", browser()));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 base::ScopedTempDir scoped_temp_dir_; 235 base::ScopedTempDir scoped_temp_dir_;
236 }; 236 };
237 237
238 const char ExtensionManagementApiEscalationTest::kId[] = 238 const char ExtensionManagementApiEscalationTest::kId[] =
239 "pgdpcfcocojkjfbgpiianjngphoopgmo"; 239 "pgdpcfcocojkjfbgpiianjngphoopgmo";
240 240
241 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, 241 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest,
242 DisabledReason) { 242 DisabledReason) {
243 scoped_refptr<ManagementGetFunction> function = 243 scoped_refptr<ManagementGetFunction> function =
244 new ManagementGetFunction(); 244 new ManagementGetFunction();
245 scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( 245 std::unique_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult(
246 function.get(), 246 function.get(), base::StringPrintf("[\"%s\"]", kId), browser()));
247 base::StringPrintf("[\"%s\"]", kId),
248 browser()));
249 ASSERT_TRUE(result.get() != NULL); 247 ASSERT_TRUE(result.get() != NULL);
250 ASSERT_TRUE(result->IsType(base::Value::TYPE_DICTIONARY)); 248 ASSERT_TRUE(result->IsType(base::Value::TYPE_DICTIONARY));
251 base::DictionaryValue* dict = 249 base::DictionaryValue* dict =
252 static_cast<base::DictionaryValue*>(result.get()); 250 static_cast<base::DictionaryValue*>(result.get());
253 std::string reason; 251 std::string reason;
254 EXPECT_TRUE(dict->GetStringASCII(keys::kDisabledReasonKey, &reason)); 252 EXPECT_TRUE(dict->GetStringASCII(keys::kDisabledReasonKey, &reason));
255 EXPECT_EQ(reason, std::string(keys::kDisabledReasonPermissionsIncrease)); 253 EXPECT_EQ(reason, std::string(keys::kDisabledReasonPermissionsIncrease));
256 } 254 }
257 255
258 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, 256 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 SetEnabled(false, true, std::string()); 288 SetEnabled(false, true, std::string());
291 SetEnabled(true, true, std::string()); 289 SetEnabled(true, true, std::string());
292 const Extension* extension = ExtensionSystem::Get(browser()->profile()) 290 const Extension* extension = ExtensionSystem::Get(browser()->profile())
293 ->extension_service() 291 ->extension_service()
294 ->GetExtensionById(kId, false); 292 ->GetExtensionById(kId, false);
295 EXPECT_TRUE(extension); 293 EXPECT_TRUE(extension);
296 } 294 }
297 } 295 }
298 296
299 } // namespace extensions 297 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698