OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_function_test_utils.h" | 8 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 9 #include "chrome/browser/extensions/extension_list_bubble.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/suspicious_extension_bubble.h" | |
11 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" | 11 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" |
12 #include "chrome/browser/extensions/test_extension_system.h" | 12 #include "chrome/browser/extensions/test_extension_system.h" |
13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
14 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
15 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 // A test class for the SuspiciousExtensionBubbleController. | 19 // A test class for the SuspiciousExtensionBubbleController. |
20 class TestSuspiciousExtensionBubbleController | 20 class TestSuspiciousExtensionBubbleController |
(...skipping 26 matching lines...) Expand all Loading... |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 size_t dismiss_button_callback_count_; | 50 size_t dismiss_button_callback_count_; |
51 size_t link_click_callback_count_; | 51 size_t link_click_callback_count_; |
52 }; | 52 }; |
53 | 53 |
54 // A fake bubble used for testing the controller. Takes an action that specifies | 54 // A fake bubble used for testing the controller. Takes an action that specifies |
55 // what should happen when the bubble is "shown" (the bubble is actually not | 55 // what should happen when the bubble is "shown" (the bubble is actually not |
56 // shown, the corresponding action is taken immediately). | 56 // shown, the corresponding action is taken immediately). |
57 class FakeSuspiciousExtensionBubble : public SuspiciousExtensionBubble { | 57 class FakeSuspiciousExtensionBubble : public ExtensionListBubble { |
58 public: | 58 public: |
59 enum SuspiciousExtensionBubbleAction { | 59 enum SuspiciousExtensionBubbleAction { |
60 BUBBLE_ACTION_CLICK_BUTTON = 0, | 60 BUBBLE_ACTION_CLICK_BUTTON = 0, |
61 BUBBLE_ACTION_CLICK_LINK | 61 BUBBLE_ACTION_CLICK_LINK |
62 }; | 62 }; |
63 | 63 |
64 FakeSuspiciousExtensionBubble() {} | 64 FakeSuspiciousExtensionBubble() {} |
65 | 65 |
66 void set_action_on_show(SuspiciousExtensionBubbleAction action) { | 66 void set_action_on_show(SuspiciousExtensionBubbleAction action) { |
67 action_ = action; | 67 action_ = action; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 suspicious_extensions = controller->GetSuspiciousExtensionNames(); | 223 suspicious_extensions = controller->GetSuspiciousExtensionNames(); |
224 ASSERT_EQ(2U, suspicious_extensions.size()); | 224 ASSERT_EQ(2U, suspicious_extensions.size()); |
225 EXPECT_TRUE(ASCIIToUTF16("Extension 1") == suspicious_extensions[1]); | 225 EXPECT_TRUE(ASCIIToUTF16("Extension 1") == suspicious_extensions[1]); |
226 EXPECT_TRUE(ASCIIToUTF16("Extension 2") == suspicious_extensions[0]); | 226 EXPECT_TRUE(ASCIIToUTF16("Extension 2") == suspicious_extensions[0]); |
227 controller->Show(&bubble); // Simulate showing the bubble. | 227 controller->Show(&bubble); // Simulate showing the bubble. |
228 EXPECT_EQ(1U, controller->link_click_count()); | 228 EXPECT_EQ(1U, controller->link_click_count()); |
229 EXPECT_EQ(0U, controller->dismiss_click_count()); | 229 EXPECT_EQ(0U, controller->dismiss_click_count()); |
230 } | 230 } |
231 | 231 |
232 } // namespace extensions | 232 } // namespace extensions |
OLD | NEW |