| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/extensions/extension_action_manager.h" | 12 #include "chrome/browser/extensions/extension_action_manager.h" |
| 13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 14 #include "chrome/browser/extensions/script_badge_controller.h" | 14 #include "chrome/browser/extensions/script_badge_controller.h" |
| 15 #include "chrome/browser/extensions/tab_helper.h" | 15 #include "chrome/browser/extensions/tab_helper.h" |
| 16 #include "chrome/browser/extensions/test_extension_system.h" | 16 #include "chrome/browser/extensions/test_extension_system.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/extensions/extension_builder.h" | 20 #include "chrome/common/extensions/extension_builder.h" |
| 21 #include "chrome/common/extensions/feature_switch.h" | 21 #include "chrome/common/extensions/feature_switch.h" |
| 22 #include "chrome/common/extensions/features/feature.h" | 22 #include "chrome/common/extensions/features/feature_channel.h" |
| 23 #include "chrome/common/extensions/value_builder.h" | 23 #include "chrome/common/extensions/value_builder.h" |
| 24 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 24 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 25 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
| 26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/navigation_entry.h" | 27 #include "content/public/browser/navigation_entry.h" |
| 28 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
| 29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
| 30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 ExtensionAction* GetScriptBadge(const Extension& extension) { | 99 ExtensionAction* GetScriptBadge(const Extension& extension) { |
| 100 return ExtensionActionManager::Get(profile())->GetScriptBadge(extension); | 100 return ExtensionActionManager::Get(profile())->GetScriptBadge(extension); |
| 101 } | 101 } |
| 102 | 102 |
| 103 ExtensionService* extension_service_; | 103 ExtensionService* extension_service_; |
| 104 ScriptBadgeController* script_badge_controller_; | 104 ScriptBadgeController* script_badge_controller_; |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 FeatureSwitch::ScopedOverride feature_override_; | 107 FeatureSwitch::ScopedOverride feature_override_; |
| 108 Feature::ScopedCurrentChannel current_channel_; | 108 ScopedCurrentChannel current_channel_; |
| 109 | 109 |
| 110 #if defined OS_CHROMEOS | 110 #if defined OS_CHROMEOS |
| 111 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 111 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 112 chromeos::ScopedTestCrosSettings test_cros_settings_; | 112 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 113 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; | 113 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; |
| 114 #endif | 114 #endif |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 struct CountingNotificationObserver : public content::NotificationObserver { | 117 struct CountingNotificationObserver : public content::NotificationObserver { |
| 118 CountingNotificationObserver() : events(0) {} | 118 CountingNotificationObserver() : events(0) {} |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Getting attention a second time should have no effect. | 268 // Getting attention a second time should have no effect. |
| 269 script_badge_controller_->GetAttentionFor(extension->id()); | 269 script_badge_controller_->GetAttentionFor(extension->id()); |
| 270 | 270 |
| 271 EXPECT_THAT(script_badge_controller_->GetCurrentActions(), | 271 EXPECT_THAT(script_badge_controller_->GetCurrentActions(), |
| 272 testing::ElementsAre(GetScriptBadge(*extension.get()))); | 272 testing::ElementsAre(GetScriptBadge(*extension.get()))); |
| 273 EXPECT_EQ(0, subsequent_get_attention_call.events); | 273 EXPECT_EQ(0, subsequent_get_attention_call.events); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace | 276 } // namespace |
| 277 } // namespace extensions | 277 } // namespace extensions |
| OLD | NEW |