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/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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 const char ExtensionManagementApiEscalationTest::kId[] = | 237 const char ExtensionManagementApiEscalationTest::kId[] = |
238 "pgdpcfcocojkjfbgpiianjngphoopgmo"; | 238 "pgdpcfcocojkjfbgpiianjngphoopgmo"; |
239 | 239 |
240 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, | 240 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, |
241 DisabledReason) { | 241 DisabledReason) { |
242 scoped_refptr<ManagementGetFunction> function = | 242 scoped_refptr<ManagementGetFunction> function = |
243 new ManagementGetFunction(); | 243 new ManagementGetFunction(); |
244 std::unique_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( | 244 std::unique_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( |
245 function.get(), base::StringPrintf("[\"%s\"]", kId), browser())); | 245 function.get(), base::StringPrintf("[\"%s\"]", kId), browser())); |
246 ASSERT_TRUE(result.get() != NULL); | 246 ASSERT_TRUE(result.get() != NULL); |
247 ASSERT_TRUE(result->IsType(base::Value::TYPE_DICTIONARY)); | 247 ASSERT_TRUE(result->IsType(base::Value::Type::DICTIONARY)); |
248 base::DictionaryValue* dict = | 248 base::DictionaryValue* dict = |
249 static_cast<base::DictionaryValue*>(result.get()); | 249 static_cast<base::DictionaryValue*>(result.get()); |
250 std::string reason; | 250 std::string reason; |
251 EXPECT_TRUE(dict->GetStringASCII(keys::kDisabledReasonKey, &reason)); | 251 EXPECT_TRUE(dict->GetStringASCII(keys::kDisabledReasonKey, &reason)); |
252 EXPECT_EQ(reason, std::string(keys::kDisabledReasonPermissionsIncrease)); | 252 EXPECT_EQ(reason, std::string(keys::kDisabledReasonPermissionsIncrease)); |
253 } | 253 } |
254 | 254 |
255 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, | 255 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, |
256 SetEnabled) { | 256 SetEnabled) { |
257 // Expect an error about no gesture. | 257 // Expect an error about no gesture. |
(...skipping 29 matching lines...) Expand all Loading... |
287 SetEnabled(false, true, std::string()); | 287 SetEnabled(false, true, std::string()); |
288 SetEnabled(true, true, std::string()); | 288 SetEnabled(true, true, std::string()); |
289 const Extension* extension = ExtensionSystem::Get(browser()->profile()) | 289 const Extension* extension = ExtensionSystem::Get(browser()->profile()) |
290 ->extension_service() | 290 ->extension_service() |
291 ->GetExtensionById(kId, false); | 291 ->GetExtensionById(kId, false); |
292 EXPECT_TRUE(extension); | 292 EXPECT_TRUE(extension); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 } // namespace extensions | 296 } // namespace extensions |
OLD | NEW |