| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/background/background_mode_manager.h" | 10 #include "chrome/browser/background/background_mode_manager.h" |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 866 |
| 867 scoped_refptr<extensions::Extension> upgraded_no_bg_ext_has_bg( | 867 scoped_refptr<extensions::Extension> upgraded_no_bg_ext_has_bg( |
| 868 CreateExtension( | 868 CreateExtension( |
| 869 extensions::Manifest::COMMAND_LINE, | 869 extensions::Manifest::COMMAND_LINE, |
| 870 "{\"name\": \"Regular Extension\", " | 870 "{\"name\": \"Regular Extension\", " |
| 871 "\"version\": \"2.0\"," | 871 "\"version\": \"2.0\"," |
| 872 "\"manifest_version\": 2," | 872 "\"manifest_version\": 2," |
| 873 "\"permissions\": [\"background\"]}", | 873 "\"permissions\": [\"background\"]}", |
| 874 "ID-2")); | 874 "ID-2")); |
| 875 | 875 |
| 876 scoped_refptr<extensions::Extension> ephemeral_app( | |
| 877 CreateExtension( | |
| 878 extensions::Manifest::COMMAND_LINE, | |
| 879 "{\"name\": \"Ephemeral App\", " | |
| 880 "\"version\": \"1.0\"," | |
| 881 "\"manifest_version\": 2," | |
| 882 "\"permissions\": [\"pushMessaging\"]}", | |
| 883 "ID-3")); | |
| 884 | |
| 885 static_cast<extensions::TestExtensionSystem*>( | 876 static_cast<extensions::TestExtensionSystem*>( |
| 886 extensions::ExtensionSystem::Get(profile_)) | 877 extensions::ExtensionSystem::Get(profile_)) |
| 887 ->CreateExtensionService(base::CommandLine::ForCurrentProcess(), | 878 ->CreateExtensionService(base::CommandLine::ForCurrentProcess(), |
| 888 base::FilePath(), false); | 879 base::FilePath(), false); |
| 889 | 880 |
| 890 ExtensionService* service = | 881 ExtensionService* service = |
| 891 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 882 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 892 ASSERT_FALSE(service->is_ready()); | 883 ASSERT_FALSE(service->is_ready()); |
| 893 service->Init(); | 884 service->Init(); |
| 894 | 885 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 916 EXPECT_CALL(*manager_, EnableLaunchOnStartup(true)).Times(Exactly(1)); | 907 EXPECT_CALL(*manager_, EnableLaunchOnStartup(true)).Times(Exactly(1)); |
| 917 } | 908 } |
| 918 service->AddExtension(upgraded_bg_ext.get()); | 909 service->AddExtension(upgraded_bg_ext.get()); |
| 919 Mock::VerifyAndClearExpectations(manager_.get()); | 910 Mock::VerifyAndClearExpectations(manager_.get()); |
| 920 EXPECT_FALSE(manager_->HasShownBalloon()); | 911 EXPECT_FALSE(manager_->HasShownBalloon()); |
| 921 | 912 |
| 922 // Upgrading an extension that didn't have background to one that does should | 913 // Upgrading an extension that didn't have background to one that does should |
| 923 // show the balloon. | 914 // show the balloon. |
| 924 service->AddExtension(upgraded_no_bg_ext_has_bg.get()); | 915 service->AddExtension(upgraded_no_bg_ext_has_bg.get()); |
| 925 EXPECT_TRUE(manager_->HasShownBalloon()); | 916 EXPECT_TRUE(manager_->HasShownBalloon()); |
| 926 | |
| 927 // Installing an ephemeral app should not show the balloon. | |
| 928 manager_->SetHasShownBalloon(false); | |
| 929 AddEphemeralApp(ephemeral_app.get(), service); | |
| 930 EXPECT_FALSE(manager_->HasShownBalloon()); | |
| 931 | |
| 932 // Promoting the ephemeral app to a regular installed app should now show | |
| 933 // the balloon. | |
| 934 service->PromoteEphemeralApp(ephemeral_app.get(), false /* from sync */); | |
| 935 EXPECT_TRUE(manager_->HasShownBalloon()); | |
| 936 } | 917 } |
| OLD | NEW |