| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 492 } |
| 493 | 493 |
| 494 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorage) { | 494 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorage) { |
| 495 // Set policies for the test extension. | 495 // Set policies for the test extension. |
| 496 scoped_ptr<base::DictionaryValue> policy = | 496 scoped_ptr<base::DictionaryValue> policy = |
| 497 extensions::DictionaryBuilder() | 497 extensions::DictionaryBuilder() |
| 498 .Set("string-policy", "value") | 498 .Set("string-policy", "value") |
| 499 .Set("int-policy", -123) | 499 .Set("int-policy", -123) |
| 500 .Set("double-policy", 456e7) | 500 .Set("double-policy", 456e7) |
| 501 .SetBoolean("boolean-policy", true) | 501 .SetBoolean("boolean-policy", true) |
| 502 .Set("list-policy", | 502 .Set("list-policy", extensions::ListBuilder() |
| 503 std::move( | 503 .Append("one") |
| 504 extensions::ListBuilder().Append("one").Append("two").Append( | 504 .Append("two") |
| 505 "three"))) | 505 .Append("three") |
| 506 .Set( | 506 .Build()) |
| 507 "dict-policy", | 507 .Set("dict-policy", |
| 508 std::move(extensions::DictionaryBuilder().Set( | 508 extensions::DictionaryBuilder() |
| 509 "list", | 509 .Set("list", extensions::ListBuilder() |
| 510 std::move( | 510 .Append(extensions::DictionaryBuilder() |
| 511 extensions::ListBuilder() | 511 .Set("one", 1) |
| 512 .Append(std::move( | 512 .Set("two", 2) |
| 513 extensions::DictionaryBuilder().Set("one", 1).Set( | 513 .Build()) |
| 514 "two", 2))) | 514 .Append(extensions::DictionaryBuilder() |
| 515 .Append(std::move(extensions::DictionaryBuilder().Set( | 515 .Set("three", 3) |
| 516 "three", 3))))))) | 516 .Build()) |
| 517 .Build()) |
| 518 .Build()) |
| 517 .Build(); | 519 .Build(); |
| 518 SetPolicies(*policy); | 520 SetPolicies(*policy); |
| 519 // Now run the extension. | 521 // Now run the extension. |
| 520 ASSERT_TRUE(RunExtensionTest("settings/managed_storage")) << message_; | 522 ASSERT_TRUE(RunExtensionTest("settings/managed_storage")) << message_; |
| 521 } | 523 } |
| 522 | 524 |
| 523 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, | 525 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, |
| 524 DISABLED_PRE_ManagedStorageEvents) { | 526 DISABLED_PRE_ManagedStorageEvents) { |
| 525 ResultCatcher catcher; | 527 ResultCatcher catcher; |
| 526 | 528 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 // ENABLE_CONFIGURATION_POLICY is not defined. | 582 // ENABLE_CONFIGURATION_POLICY is not defined. |
| 581 StorageFrontend* frontend = StorageFrontend::Get(browser()->profile()); | 583 StorageFrontend* frontend = StorageFrontend::Get(browser()->profile()); |
| 582 frontend->DisableStorageForTesting(MANAGED); | 584 frontend->DisableStorageForTesting(MANAGED); |
| 583 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 585 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
| 584 // Now run the extension. | 586 // Now run the extension. |
| 585 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) | 587 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) |
| 586 << message_; | 588 << message_; |
| 587 } | 589 } |
| 588 | 590 |
| 589 } // namespace extensions | 591 } // namespace extensions |
| OLD | NEW |