| 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 <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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 GURL(), | 460 GURL(), |
| 461 ExtensionEventRouter::USER_GESTURE_ENABLED)) | 461 ExtensionEventRouter::USER_GESTURE_ENABLED)) |
| 462 .Times(1) | 462 .Times(1) |
| 463 .WillOnce(SaveArg<2>(&event_args)); | 463 .WillOnce(SaveArg<2>(&event_args)); |
| 464 | 464 |
| 465 manager_.ExecuteCommand(&profile, NULL /* tab_contents */, params, id); | 465 manager_.ExecuteCommand(&profile, NULL /* tab_contents */, params, id); |
| 466 | 466 |
| 467 // Parse the json event_args, which should turn into a 2-element list where | 467 // Parse the json event_args, which should turn into a 2-element list where |
| 468 // the first element is a dictionary we want to inspect for the correct | 468 // the first element is a dictionary we want to inspect for the correct |
| 469 // values. | 469 // values. |
| 470 scoped_ptr<Value> result(base::JSONReader::Read(event_args, true)); | 470 scoped_ptr<Value> result( |
| 471 base::JSONReader::Read(event_args, base::JSON_ALLOW_TRAILING_COMMAS)); |
| 471 Value* value = result.get(); | 472 Value* value = result.get(); |
| 472 ASSERT_TRUE(result.get() != NULL); | 473 ASSERT_TRUE(result.get() != NULL); |
| 473 ASSERT_EQ(Value::TYPE_LIST, value->GetType()); | 474 ASSERT_EQ(Value::TYPE_LIST, value->GetType()); |
| 474 ListValue* list = static_cast<ListValue*>(value); | 475 ListValue* list = static_cast<ListValue*>(value); |
| 475 ASSERT_EQ(2u, list->GetSize()); | 476 ASSERT_EQ(2u, list->GetSize()); |
| 476 | 477 |
| 477 DictionaryValue* info; | 478 DictionaryValue* info; |
| 478 ASSERT_TRUE(list->GetDictionary(0, &info)); | 479 ASSERT_TRUE(list->GetDictionary(0, &info)); |
| 479 | 480 |
| 480 int tmp_id = 0; | 481 int tmp_id = 0; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 manager_.ChangeParent(child1->id(), NULL); | 582 manager_.ChangeParent(child1->id(), NULL); |
| 582 ASSERT_TRUE(new_item->checked()); | 583 ASSERT_TRUE(new_item->checked()); |
| 583 ASSERT_TRUE(child1->checked()); | 584 ASSERT_TRUE(child1->checked()); |
| 584 | 585 |
| 585 // Removing |parent| should cause only |child1| to be selected. | 586 // Removing |parent| should cause only |child1| to be selected. |
| 586 manager_.RemoveContextMenuItem(parent->id()); | 587 manager_.RemoveContextMenuItem(parent->id()); |
| 587 parent = NULL; | 588 parent = NULL; |
| 588 ASSERT_FALSE(new_item->checked()); | 589 ASSERT_FALSE(new_item->checked()); |
| 589 ASSERT_TRUE(child1->checked()); | 590 ASSERT_TRUE(child1->checked()); |
| 590 } | 591 } |
| OLD | NEW |