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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
10 #include "chrome/browser/extensions/settings/settings_frontend.h" | 10 #include "chrome/browser/extensions/settings/settings_frontend.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 // Now change the policies and wait until the extension is done. | 473 // Now change the policies and wait until the extension is done. |
474 policy = extensions::DictionaryBuilder() | 474 policy = extensions::DictionaryBuilder() |
475 .Set("constant-policy", "aaa") | 475 .Set("constant-policy", "aaa") |
476 .Set("changes-policy", "ddd") | 476 .Set("changes-policy", "ddd") |
477 .Set("new-policy", "eee") | 477 .Set("new-policy", "eee") |
478 .Build(); | 478 .Build(); |
479 SetPolicies(*policy); | 479 SetPolicies(*policy); |
480 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 480 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
481 } | 481 } |
482 | 482 |
483 // TODO(joaodasilva): This test times out on Vista. http://crbug.com/166261 | |
484 #if !defined(OS_WIN) | |
485 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageEvents) { | 483 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageEvents) { |
486 // This test runs after PRE_ManagedStorageEvents without having deleted the | 484 // This test runs after PRE_ManagedStorageEvents without having deleted the |
487 // profile, so the extension is still around. While the browser restarted the | 485 // profile, so the extension is still around. While the browser restarted the |
488 // policy went back to the empty default, and so the extension should receive | 486 // policy went back to the empty default, and so the extension should receive |
489 // the corresponding change events. | 487 // the corresponding change events. |
490 | 488 |
491 ResultCatcher catcher; | 489 ResultCatcher catcher; |
492 | 490 |
493 // Verify that the test extension is still installed. | 491 // Verify that the test extension is still installed. |
494 const Extension* extension = GetSingleLoadedExtension(); | 492 const Extension* extension = GetSingleLoadedExtension(); |
495 ASSERT_TRUE(extension); | 493 ASSERT_TRUE(extension); |
496 EXPECT_EQ(kManagedStorageExtensionId, extension->id()); | 494 EXPECT_EQ(kManagedStorageExtensionId, extension->id()); |
497 | 495 |
498 // Running the test again skips the onInstalled callback, and just triggers | 496 // Running the test again skips the onInstalled callback, and just triggers |
499 // the onChanged notification. | 497 // the onChanged notification. |
500 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 498 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
501 } | 499 } |
502 #endif // !defined(OS_WIN) | |
503 | 500 |
504 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 501 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
505 | 502 |
506 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageDisabled) { | 503 IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorageDisabled) { |
507 // Disable the 'managed' namespace. This is redundant when | 504 // Disable the 'managed' namespace. This is redundant when |
508 // ENABLE_CONFIGURATION_POLICY is not defined. | 505 // ENABLE_CONFIGURATION_POLICY is not defined. |
509 SettingsFrontend* frontend = | 506 SettingsFrontend* frontend = |
510 browser()->profile()->GetExtensionService()->settings_frontend(); | 507 browser()->profile()->GetExtensionService()->settings_frontend(); |
511 frontend->DisableStorageForTesting(MANAGED); | 508 frontend->DisableStorageForTesting(MANAGED); |
512 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 509 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
513 // Now run the extension. | 510 // Now run the extension. |
514 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) | 511 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) |
515 << message_; | 512 << message_; |
516 } | 513 } |
517 | 514 |
518 } // namespace extensions | 515 } // namespace extensions |
OLD | NEW |