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 "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 | 228 |
229 private: | 229 private: |
230 base::ScopedTempDir scoped_temp_dir_; | 230 base::ScopedTempDir scoped_temp_dir_; |
231 }; | 231 }; |
232 | 232 |
233 const char ExtensionManagementApiEscalationTest::kId[] = | 233 const char ExtensionManagementApiEscalationTest::kId[] = |
234 "pgdpcfcocojkjfbgpiianjngphoopgmo"; | 234 "pgdpcfcocojkjfbgpiianjngphoopgmo"; |
235 | 235 |
| 236 // Temporarily disabled in official builds. See crbug.com/567497 for details. |
| 237 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 238 #define MAYBE_DisabledReason DISABLED_DisabledReason |
| 239 #else |
| 240 #define MAYBE_DisabledReason DisabledReason |
| 241 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
236 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, | 242 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, |
237 DisabledReason) { | 243 MAYBE_DisabledReason) { |
238 scoped_refptr<ManagementGetFunction> function = | 244 scoped_refptr<ManagementGetFunction> function = |
239 new ManagementGetFunction(); | 245 new ManagementGetFunction(); |
240 scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( | 246 scoped_ptr<base::Value> result(util::RunFunctionAndReturnSingleResult( |
241 function.get(), | 247 function.get(), |
242 base::StringPrintf("[\"%s\"]", kId), | 248 base::StringPrintf("[\"%s\"]", kId), |
243 browser())); | 249 browser())); |
244 ASSERT_TRUE(result.get() != NULL); | 250 ASSERT_TRUE(result.get() != NULL); |
245 ASSERT_TRUE(result->IsType(base::Value::TYPE_DICTIONARY)); | 251 ASSERT_TRUE(result->IsType(base::Value::TYPE_DICTIONARY)); |
246 base::DictionaryValue* dict = | 252 base::DictionaryValue* dict = |
247 static_cast<base::DictionaryValue*>(result.get()); | 253 static_cast<base::DictionaryValue*>(result.get()); |
248 std::string reason; | 254 std::string reason; |
249 EXPECT_TRUE(dict->GetStringASCII(keys::kDisabledReasonKey, &reason)); | 255 EXPECT_TRUE(dict->GetStringASCII(keys::kDisabledReasonKey, &reason)); |
250 EXPECT_EQ(reason, std::string(keys::kDisabledReasonPermissionsIncrease)); | 256 EXPECT_EQ(reason, std::string(keys::kDisabledReasonPermissionsIncrease)); |
251 } | 257 } |
252 | 258 |
253 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, | 259 // Temporarily disabled in official builds. See crbug.com/567497 for details. |
254 SetEnabled) { | 260 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 261 #define MAYBE_SetEnabled DISABLED_SetEnabled |
| 262 #else |
| 263 #define MAYBE_SetEnabled SetEnabled |
| 264 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 265 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, MAYBE_SetEnabled) { |
255 // Expect an error about no gesture. | 266 // Expect an error about no gesture. |
256 SetEnabled(true, false, keys::kGestureNeededForEscalationError); | 267 SetEnabled(true, false, keys::kGestureNeededForEscalationError); |
257 | 268 |
258 { | 269 { |
259 // Expect an error that user cancelled the dialog. | 270 // Expect an error that user cancelled the dialog. |
260 ScopedTestDialogAutoConfirm auto_confirm( | 271 ScopedTestDialogAutoConfirm auto_confirm( |
261 ScopedTestDialogAutoConfirm::CANCEL); | 272 ScopedTestDialogAutoConfirm::CANCEL); |
262 SetEnabled(true, true, keys::kUserDidNotReEnableError); | 273 SetEnabled(true, true, keys::kUserDidNotReEnableError); |
263 } | 274 } |
264 | 275 |
(...skipping 20 matching lines...) Expand all Loading... |
285 SetEnabled(false, true, std::string()); | 296 SetEnabled(false, true, std::string()); |
286 SetEnabled(true, true, std::string()); | 297 SetEnabled(true, true, std::string()); |
287 const Extension* extension = ExtensionSystem::Get(browser()->profile()) | 298 const Extension* extension = ExtensionSystem::Get(browser()->profile()) |
288 ->extension_service() | 299 ->extension_service() |
289 ->GetExtensionById(kId, false); | 300 ->GetExtensionById(kId, false); |
290 EXPECT_TRUE(extension); | 301 EXPECT_TRUE(extension); |
291 } | 302 } |
292 } | 303 } |
293 | 304 |
294 } // namespace extensions | 305 } // namespace extensions |
OLD | NEW |