Lines Matching defs:item1
75 ExtensionMenuItem* item1 = CreateTestItem(extension);
76 ASSERT_TRUE(item1 != NULL);
77 ASSERT_TRUE(manager_.AddContextItem(extension, item1));
78 ASSERT_EQ(item1, manager_.GetItemById(item1->id()));
80 manager_.MenuItems(item1->extension_id());
82 ASSERT_EQ(item1, items->at(0));
90 ASSERT_EQ(item1, items->at(0));
115 ExtensionMenuItem* item1 = CreateTestItem(extension1);
125 ASSERT_TRUE(manager_.AddContextItem(extension1, item1));
128 ExtensionMenuItem::Id id1 = item1->id();
139 ASSERT_EQ(0, item1->child_count());
142 ASSERT_EQ(1u, manager_.MenuItems(item1->extension_id())->size());
143 ASSERT_EQ(item1, manager_.MenuItems(item1->extension_id())->at(0));
169 ExtensionMenuItem* item1 = CreateTestItem(extension);
175 ExtensionMenuItem::Id item1_id = item1->id();
183 // item1 -> item2 -> item3 -> item4 -> item5 -> item6.
184 ASSERT_TRUE(manager_.AddContextItem(extension, item1));
190 ASSERT_EQ(item1, manager_.GetItemById(item1_id));
201 ASSERT_EQ(item1, manager_.GetItemById(item1_id));
212 ASSERT_EQ(item1, manager_.GetItemById(item1_id));
220 // Now remove item1 and make sure item2 and item3 are gone as well.
234 ExtensionMenuItem* item1 = CreateTestItem(extension1);
237 ASSERT_TRUE(manager_.AddContextItem(extension1, item1));
241 manager_.MenuItems(item1->extension_id());
243 ASSERT_EQ(item1, items->at(0));
246 // Now create a third item, initially add it as a child of item1, then move
250 ASSERT_TRUE(manager_.AddChildItem(item1->id(), item3));
251 ASSERT_EQ(1, item1->child_count());
252 ASSERT_EQ(item3, item1->children()[0]);
255 ASSERT_EQ(0, item1->child_count());
259 // Move item2 to be a child of item1.
260 ASSERT_TRUE(manager_.ChangeParent(item2->id(), &item1->id()));
261 ASSERT_EQ(1, item1->child_count());
262 ASSERT_EQ(item2, item1->children()[0]);
268 items = manager_.MenuItems(item1->extension_id());
270 ASSERT_EQ(item1, items->at(0));
272 // Move item3 back to being a child of item1, so it's now a sibling of item2.
273 ASSERT_TRUE(manager_.ChangeParent(item3->id(), &item1->id()));
274 ASSERT_EQ(2, item1->child_count());
275 ASSERT_EQ(item2, item1->children()[0]);
276 ASSERT_EQ(item3, item1->children()[1]);
278 // Try switching item3 to be the parent of item1 - this should fail.
279 ASSERT_FALSE(manager_.ChangeParent(item1->id(), &item3->id()));
281 ASSERT_EQ(2, item1->child_count());
282 ASSERT_EQ(item2, item1->children()[0]);
283 ASSERT_EQ(item3, item1->children()[1]);
284 items = manager_.MenuItems(item1->extension_id());
286 ASSERT_EQ(item1, items->at(0));
290 items = manager_.MenuItems(item1->extension_id());
292 ASSERT_EQ(item1, items->at(0));
294 ASSERT_EQ(1, item1->child_count());
295 ASSERT_EQ(item3, item1->children()[0]);
301 ASSERT_FALSE(manager_.ChangeParent(item4->id(), &item1->id()));
302 ASSERT_FALSE(manager_.ChangeParent(item1->id(), &item4->id()));
305 ASSERT_FALSE(manager_.ChangeParent(item1->id(), &item1->id()));
318 ExtensionMenuItem* item1 = CreateTestItem(extension1);
319 ExtensionMenuItem::Id id1 = item1->id();
320 ASSERT_EQ(extension1->id(), item1->extension_id());
321 ASSERT_TRUE(manager_.AddContextItem(extension1, item1));
327 ASSERT_NE(item1->extension_id(), item2->extension_id());
376 ExtensionMenuItem* item1 = CreateTestItem(extension1);
379 ASSERT_TRUE(manager_.AddContextItem(extension1, item1));
381 ASSERT_TRUE(manager_.AddChildItem(item1->id(), item3));
405 ExtensionMenuItem* item1 = CreateTestItem(extension1);
407 ASSERT_TRUE(manager_.AddContextItem(extension1, item1));
412 manager_.RemoveContextMenuItem(item1->id());