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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 ASSERT_EQ(1u, manager_.MenuItems(extension1->id())->size()); | 324 ASSERT_EQ(1u, manager_.MenuItems(extension1->id())->size()); |
325 | 325 |
326 // Create a menu item with a different extension id and add it to the manager. | 326 // Create a menu item with a different extension id and add it to the manager. |
327 Extension* extension2 = AddExtension("2222"); | 327 Extension* extension2 = AddExtension("2222"); |
328 ExtensionMenuItem* item2 = CreateTestItem(extension2); | 328 ExtensionMenuItem* item2 = CreateTestItem(extension2); |
329 ASSERT_NE(item1->extension_id(), item2->extension_id()); | 329 ASSERT_NE(item1->extension_id(), item2->extension_id()); |
330 ASSERT_TRUE(manager_.AddContextItem(extension2, item2)); | 330 ASSERT_TRUE(manager_.AddContextItem(extension2, item2)); |
331 | 331 |
332 // Notify that the extension was unloaded, and make sure the right item is | 332 // Notify that the extension was unloaded, and make sure the right item is |
333 // gone. | 333 // gone. |
334 UnloadedExtensionInfo details(extension1, UnloadedExtensionInfo::DISABLE); | 334 UnloadedExtensionInfo details( |
| 335 extension1, extension_misc::UNLOAD_REASON_DISABLE); |
335 notifier->Notify(chrome::NOTIFICATION_EXTENSION_UNLOADED, | 336 notifier->Notify(chrome::NOTIFICATION_EXTENSION_UNLOADED, |
336 Source<Profile>(NULL), | 337 Source<Profile>(NULL), |
337 Details<UnloadedExtensionInfo>(&details)); | 338 Details<UnloadedExtensionInfo>(&details)); |
338 ASSERT_EQ(NULL, manager_.MenuItems(extension1->id())); | 339 ASSERT_EQ(NULL, manager_.MenuItems(extension1->id())); |
339 ASSERT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 340 ASSERT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
340 ASSERT_TRUE(manager_.GetItemById(id1) == NULL); | 341 ASSERT_TRUE(manager_.GetItemById(id1) == NULL); |
341 ASSERT_TRUE(manager_.GetItemById(item2->id()) != NULL); | 342 ASSERT_TRUE(manager_.GetItemById(item2->id()) != NULL); |
342 } | 343 } |
343 | 344 |
344 // A mock message service for tests of ExtensionMenuManager::ExecuteCommand. | 345 // A mock message service for tests of ExtensionMenuManager::ExecuteCommand. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 ASSERT_EQ(params.page_url.spec(), tmp); | 483 ASSERT_EQ(params.page_url.spec(), tmp); |
483 | 484 |
484 string16 tmp16; | 485 string16 tmp16; |
485 ASSERT_TRUE(info->GetString("selectionText", &tmp16)); | 486 ASSERT_TRUE(info->GetString("selectionText", &tmp16)); |
486 ASSERT_EQ(params.selection_text, tmp16); | 487 ASSERT_EQ(params.selection_text, tmp16); |
487 | 488 |
488 bool bool_tmp = true; | 489 bool bool_tmp = true; |
489 ASSERT_TRUE(info->GetBoolean("editable", &bool_tmp)); | 490 ASSERT_TRUE(info->GetBoolean("editable", &bool_tmp)); |
490 ASSERT_EQ(params.is_editable, bool_tmp); | 491 ASSERT_EQ(params.is_editable, bool_tmp); |
491 } | 492 } |
OLD | NEW |