OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/scoped_vector.h" | 10 #include "base/scoped_vector.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 ASSERT_EQ(1u, manager_.MenuItems(extension1->id())->size()); | 315 ASSERT_EQ(1u, manager_.MenuItems(extension1->id())->size()); |
316 | 316 |
317 // Create a menu item with a different extension id and add it to the manager. | 317 // Create a menu item with a different extension id and add it to the manager. |
318 Extension* extension2 = AddExtension("2222"); | 318 Extension* extension2 = AddExtension("2222"); |
319 ExtensionMenuItem* item2 = CreateTestItem(extension2); | 319 ExtensionMenuItem* item2 = CreateTestItem(extension2); |
320 ASSERT_NE(item1->extension_id(), item2->extension_id()); | 320 ASSERT_NE(item1->extension_id(), item2->extension_id()); |
321 ASSERT_TRUE(manager_.AddContextItem(extension2, item2)); | 321 ASSERT_TRUE(manager_.AddContextItem(extension2, item2)); |
322 | 322 |
323 // Notify that the extension was unloaded, and make sure the right item is | 323 // Notify that the extension was unloaded, and make sure the right item is |
324 // gone. | 324 // gone. |
| 325 UnloadedExtensionInfo details(extension1, UnloadedExtensionInfo::DISABLE); |
325 notifier->Notify(NotificationType::EXTENSION_UNLOADED, | 326 notifier->Notify(NotificationType::EXTENSION_UNLOADED, |
326 Source<Profile>(NULL), | 327 Source<Profile>(NULL), |
327 Details<const Extension>(extension1)); | 328 Details<UnloadedExtensionInfo>(&details)); |
328 ASSERT_EQ(NULL, manager_.MenuItems(extension1->id())); | 329 ASSERT_EQ(NULL, manager_.MenuItems(extension1->id())); |
329 ASSERT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 330 ASSERT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
330 ASSERT_TRUE(manager_.GetItemById(id1) == NULL); | 331 ASSERT_TRUE(manager_.GetItemById(id1) == NULL); |
331 ASSERT_TRUE(manager_.GetItemById(item2->id()) != NULL); | 332 ASSERT_TRUE(manager_.GetItemById(item2->id()) != NULL); |
332 } | 333 } |
333 | 334 |
334 // A mock message service for tests of ExtensionMenuManager::ExecuteCommand. | 335 // A mock message service for tests of ExtensionMenuManager::ExecuteCommand. |
335 class MockExtensionEventRouter : public ExtensionEventRouter { | 336 class MockExtensionEventRouter : public ExtensionEventRouter { |
336 public: | 337 public: |
337 explicit MockExtensionEventRouter(Profile* profile) : | 338 explicit MockExtensionEventRouter(Profile* profile) : |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 ASSERT_EQ(params.page_url.spec(), tmp); | 474 ASSERT_EQ(params.page_url.spec(), tmp); |
474 | 475 |
475 string16 tmp16; | 476 string16 tmp16; |
476 ASSERT_TRUE(info->GetString("selectionText", &tmp16)); | 477 ASSERT_TRUE(info->GetString("selectionText", &tmp16)); |
477 ASSERT_EQ(params.selection_text, tmp16); | 478 ASSERT_EQ(params.selection_text, tmp16); |
478 | 479 |
479 bool bool_tmp = true; | 480 bool bool_tmp = true; |
480 ASSERT_TRUE(info->GetBoolean("editable", &bool_tmp)); | 481 ASSERT_TRUE(info->GetBoolean("editable", &bool_tmp)); |
481 ASSERT_EQ(params.is_editable, bool_tmp); | 482 ASSERT_EQ(params.is_editable, bool_tmp); |
482 } | 483 } |
OLD | NEW |