| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/chromeos/note_taking_helper.h" | 5 #include "chrome/browser/chromeos/note_taking_helper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 // Let the app-fetching callback run and check that the observer is notified. | 637 // Let the app-fetching callback run and check that the observer is notified. |
| 638 base::RunLoop().RunUntilIdle(); | 638 base::RunLoop().RunUntilIdle(); |
| 639 EXPECT_EQ(1, observer.num_updates()); | 639 EXPECT_EQ(1, observer.num_updates()); |
| 640 | 640 |
| 641 // Disabling and enabling ARC should also notify the observer (and enabling | 641 // Disabling and enabling ARC should also notify the observer (and enabling |
| 642 // should request apps again). | 642 // should request apps again). |
| 643 profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, false); | 643 profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, false); |
| 644 EXPECT_EQ(2, observer.num_updates()); | 644 EXPECT_EQ(2, observer.num_updates()); |
| 645 profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, true); | 645 profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, true); |
| 646 EXPECT_EQ(3, observer.num_updates()); | 646 EXPECT_EQ(3, observer.num_updates()); |
| 647 // Run ARC data removing operation. |
| 647 base::RunLoop().RunUntilIdle(); | 648 base::RunLoop().RunUntilIdle(); |
| 648 EXPECT_EQ(4, observer.num_updates()); | |
| 649 | 649 |
| 650 // Update intent filters and check that the observer is notified again after | 650 // Update intent filters and check that the observer is notified again after |
| 651 // apps are received. | 651 // apps are received. |
| 652 helper()->OnIntentFiltersUpdated(); | 652 helper()->OnIntentFiltersUpdated(); |
| 653 EXPECT_EQ(3, observer.num_updates()); |
| 654 base::RunLoop().RunUntilIdle(); |
| 653 EXPECT_EQ(4, observer.num_updates()); | 655 EXPECT_EQ(4, observer.num_updates()); |
| 654 base::RunLoop().RunUntilIdle(); | |
| 655 EXPECT_EQ(5, observer.num_updates()); | |
| 656 } | 656 } |
| 657 | 657 |
| 658 TEST_F(NoteTakingHelperTest, NotifyObserverAboutChromeApps) { | 658 TEST_F(NoteTakingHelperTest, NotifyObserverAboutChromeApps) { |
| 659 Init(ENABLE_PALETTE); | 659 Init(ENABLE_PALETTE); |
| 660 TestObserver observer; | 660 TestObserver observer; |
| 661 ASSERT_EQ(0, observer.num_updates()); | 661 ASSERT_EQ(0, observer.num_updates()); |
| 662 | 662 |
| 663 // Notify that the prod Keep app was installed for the initial profile. Chrome | 663 // Notify that the prod Keep app was installed for the initial profile. Chrome |
| 664 // extensions are queried dynamically when GetAvailableApps() is called, so we | 664 // extensions are queried dynamically when GetAvailableApps() is called, so we |
| 665 // don't need to actually install it. | 665 // don't need to actually install it. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 688 InitExtensionService(second_profile); | 688 InitExtensionService(second_profile); |
| 689 EXPECT_EQ(0, observer.num_updates()); | 689 EXPECT_EQ(0, observer.num_updates()); |
| 690 InstallExtension(keep_extension.get(), second_profile); | 690 InstallExtension(keep_extension.get(), second_profile); |
| 691 EXPECT_EQ(1, observer.num_updates()); | 691 EXPECT_EQ(1, observer.num_updates()); |
| 692 UninstallExtension(keep_extension.get(), second_profile); | 692 UninstallExtension(keep_extension.get(), second_profile); |
| 693 EXPECT_EQ(2, observer.num_updates()); | 693 EXPECT_EQ(2, observer.num_updates()); |
| 694 profile_manager_->DeleteTestingProfile(kSecondProfileName); | 694 profile_manager_->DeleteTestingProfile(kSecondProfileName); |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace chromeos | 697 } // namespace chromeos |
| OLD | NEW |