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/dev_mode_bubble_controller.h" | 8 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" |
9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 9 #include "chrome/browser/extensions/extension_function_test_utils.h" |
10 #include "chrome/browser/extensions/extension_message_bubble.h" | 10 #include "chrome/browser/extensions/extension_message_bubble.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 FakeExtensionMessageBubble bubble; | 253 FakeExtensionMessageBubble bubble; |
254 bubble.set_action_on_show( | 254 bubble.set_action_on_show( |
255 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_DISMISS_BUTTON); | 255 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_DISMISS_BUTTON); |
256 | 256 |
257 // Validate that we don't have a suppress value for the extensions. | 257 // Validate that we don't have a suppress value for the extensions. |
258 ExtensionPrefs* prefs = service_->extension_prefs(); | 258 ExtensionPrefs* prefs = service_->extension_prefs(); |
259 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id1_)); | 259 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id1_)); |
260 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id2_)); | 260 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id2_)); |
261 | 261 |
262 EXPECT_FALSE(controller->ShouldShow()); | 262 EXPECT_FALSE(controller->ShouldShow()); |
263 std::vector<string16> suspicious_extensions = controller->GetExtensionList(); | 263 std::vector<base::string16> suspicious_extensions = |
| 264 controller->GetExtensionList(); |
264 EXPECT_EQ(0U, suspicious_extensions.size()); | 265 EXPECT_EQ(0U, suspicious_extensions.size()); |
265 EXPECT_EQ(0U, controller->link_click_count()); | 266 EXPECT_EQ(0U, controller->link_click_count()); |
266 EXPECT_EQ(0U, controller->dismiss_click_count()); | 267 EXPECT_EQ(0U, controller->dismiss_click_count()); |
267 | 268 |
268 // Now disable an extension, specifying the wipeout flag. | 269 // Now disable an extension, specifying the wipeout flag. |
269 service_->DisableExtension(extension_id1_, | 270 service_->DisableExtension(extension_id1_, |
270 Extension::DISABLE_NOT_VERIFIED); | 271 Extension::DISABLE_NOT_VERIFIED); |
271 | 272 |
272 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id1_)); | 273 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id1_)); |
273 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id2_)); | 274 EXPECT_FALSE(prefs->HasWipeoutBeenAcknowledged(extension_id2_)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 FeatureSwitch::force_dev_mode_highlighting(), true); | 319 FeatureSwitch::force_dev_mode_highlighting(), true); |
319 // The test base class adds three extensions, and we control two of them in | 320 // The test base class adds three extensions, and we control two of them in |
320 // this test (ids are: extension_id1_ and extension_id2_). Extension 1 is a | 321 // this test (ids are: extension_id1_ and extension_id2_). Extension 1 is a |
321 // regular extension, Extension 2 is UNPACKED so it counts as a DevMode | 322 // regular extension, Extension 2 is UNPACKED so it counts as a DevMode |
322 // extension. | 323 // extension. |
323 scoped_ptr<TestDevModeBubbleController> controller( | 324 scoped_ptr<TestDevModeBubbleController> controller( |
324 new TestDevModeBubbleController(profile())); | 325 new TestDevModeBubbleController(profile())); |
325 | 326 |
326 // The list will contain one enabled unpacked extension. | 327 // The list will contain one enabled unpacked extension. |
327 EXPECT_TRUE(controller->ShouldShow()); | 328 EXPECT_TRUE(controller->ShouldShow()); |
328 std::vector<string16> dev_mode_extensions = controller->GetExtensionList(); | 329 std::vector<base::string16> dev_mode_extensions = |
| 330 controller->GetExtensionList(); |
329 ASSERT_EQ(2U, dev_mode_extensions.size()); | 331 ASSERT_EQ(2U, dev_mode_extensions.size()); |
330 EXPECT_TRUE(ASCIIToUTF16("Extension 2") == dev_mode_extensions[0]); | 332 EXPECT_TRUE(ASCIIToUTF16("Extension 2") == dev_mode_extensions[0]); |
331 EXPECT_TRUE(ASCIIToUTF16("Extension 1") == dev_mode_extensions[1]); | 333 EXPECT_TRUE(ASCIIToUTF16("Extension 1") == dev_mode_extensions[1]); |
332 EXPECT_EQ(0U, controller->link_click_count()); | 334 EXPECT_EQ(0U, controller->link_click_count()); |
333 EXPECT_EQ(0U, controller->dismiss_click_count()); | 335 EXPECT_EQ(0U, controller->dismiss_click_count()); |
334 EXPECT_EQ(0U, controller->action_click_count()); | 336 EXPECT_EQ(0U, controller->action_click_count()); |
335 | 337 |
336 // Simulate showing the bubble. | 338 // Simulate showing the bubble. |
337 FakeExtensionMessageBubble bubble; | 339 FakeExtensionMessageBubble bubble; |
338 bubble.set_action_on_show( | 340 bubble.set_action_on_show( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 service_->DisableExtension(extension_id2_, Extension::DISABLE_USER_ACTION); | 385 service_->DisableExtension(extension_id2_, Extension::DISABLE_USER_ACTION); |
384 | 386 |
385 controller.reset(new TestDevModeBubbleController( | 387 controller.reset(new TestDevModeBubbleController( |
386 profile())); | 388 profile())); |
387 EXPECT_FALSE(controller->ShouldShow()); | 389 EXPECT_FALSE(controller->ShouldShow()); |
388 dev_mode_extensions = controller->GetExtensionList(); | 390 dev_mode_extensions = controller->GetExtensionList(); |
389 EXPECT_EQ(0U, dev_mode_extensions.size()); | 391 EXPECT_EQ(0U, dev_mode_extensions.size()); |
390 } | 392 } |
391 | 393 |
392 } // namespace extensions | 394 } // namespace extensions |
OLD | NEW |