| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 543 |
| 544 // This extension doesn't exist, so it should return -1. | 544 // This extension doesn't exist, so it should return -1. |
| 545 EXPECT_EQ(-1, prefs()->GetAppLaunchIndex("foo")); | 545 EXPECT_EQ(-1, prefs()->GetAppLaunchIndex("foo")); |
| 546 } | 546 } |
| 547 | 547 |
| 548 private: | 548 private: |
| 549 scoped_refptr<Extension> extension_; | 549 scoped_refptr<Extension> extension_; |
| 550 }; | 550 }; |
| 551 TEST_F(ExtensionPrefsAppLaunchIndex, ExtensionPrefsAppLaunchIndex) {} | 551 TEST_F(ExtensionPrefsAppLaunchIndex, ExtensionPrefsAppLaunchIndex) {} |
| 552 | 552 |
| 553 class ExtensionPrefsAppDraggedByUser : public ExtensionPrefsTest { |
| 554 public: |
| 555 virtual void Initialize() { |
| 556 extension_ = prefs_.AddExtension("on_extension_installed"); |
| 557 EXPECT_FALSE(prefs()->WasAppDraggedByUser(extension_->id())); |
| 558 prefs()->OnExtensionInstalled(extension_.get(), |
| 559 Extension::ENABLED, false); |
| 560 } |
| 561 |
| 562 virtual void Verify() { |
| 563 // Set the flag and see if it persisted. |
| 564 prefs()->SetAppDraggedByUser(extension_->id()); |
| 565 EXPECT_TRUE(prefs()->WasAppDraggedByUser(extension_->id())); |
| 566 |
| 567 // Make sure it doesn't change on consecutive calls. |
| 568 prefs()->SetAppDraggedByUser(extension_->id()); |
| 569 EXPECT_TRUE(prefs()->WasAppDraggedByUser(extension_->id())); |
| 570 } |
| 571 |
| 572 private: |
| 573 scoped_refptr<Extension> extension_; |
| 574 }; |
| 575 TEST_F(ExtensionPrefsAppDraggedByUser, ExtensionPrefsAppDraggedByUser) {} |
| 576 |
| 553 namespace keys = extension_manifest_keys; | 577 namespace keys = extension_manifest_keys; |
| 554 | 578 |
| 555 class ExtensionPrefsPreferencesBase : public ExtensionPrefsTest { | 579 class ExtensionPrefsPreferencesBase : public ExtensionPrefsTest { |
| 556 public: | 580 public: |
| 557 ExtensionPrefsPreferencesBase() | 581 ExtensionPrefsPreferencesBase() |
| 558 : ExtensionPrefsTest(), | 582 : ExtensionPrefsTest(), |
| 559 ext1_(NULL), | 583 ext1_(NULL), |
| 560 ext2_(NULL), | 584 ext2_(NULL), |
| 561 ext3_(NULL), | 585 ext3_(NULL), |
| 562 installed() { | 586 installed() { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 testing::Mock::VerifyAndClearExpectations(v1i); | 877 testing::Mock::VerifyAndClearExpectations(v1i); |
| 854 testing::Mock::VerifyAndClearExpectations(v2); | 878 testing::Mock::VerifyAndClearExpectations(v2); |
| 855 testing::Mock::VerifyAndClearExpectations(v2i); | 879 testing::Mock::VerifyAndClearExpectations(v2i); |
| 856 } | 880 } |
| 857 | 881 |
| 858 virtual void Verify() { | 882 virtual void Verify() { |
| 859 } | 883 } |
| 860 }; | 884 }; |
| 861 TEST_F(ExtensionPrefsSetExtensionControlledPref, | 885 TEST_F(ExtensionPrefsSetExtensionControlledPref, |
| 862 ExtensionPrefsSetExtensionControlledPref) {} | 886 ExtensionPrefsSetExtensionControlledPref) {} |
| OLD | NEW |