| 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 "chrome/browser/extensions/menu_manager.h" | 5 #include "chrome/browser/extensions/menu_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 std::string title("TITLE"); | 218 std::string title("TITLE"); |
| 219 bool checked = true; | 219 bool checked = true; |
| 220 bool enabled = true; | 220 bool enabled = true; |
| 221 MenuItem::ContextList contexts; | 221 MenuItem::ContextList contexts; |
| 222 contexts.Add(MenuItem::PAGE); | 222 contexts.Add(MenuItem::PAGE); |
| 223 contexts.Add(MenuItem::SELECTION); | 223 contexts.Add(MenuItem::SELECTION); |
| 224 int contexts_value = 0; | 224 int contexts_value = 0; |
| 225 ASSERT_TRUE(contexts.ToValue()->GetAsInteger(&contexts_value)); | 225 ASSERT_TRUE(contexts.ToValue()->GetAsInteger(&contexts_value)); |
| 226 | 226 |
| 227 base::ListValue* document_url_patterns(new base::ListValue()); | 227 base::ListValue* document_url_patterns(new base::ListValue()); |
| 228 document_url_patterns->Append( | 228 document_url_patterns->AppendString("http://www.google.com/*"); |
| 229 new base::StringValue("http://www.google.com/*")); | 229 document_url_patterns->AppendString("http://www.reddit.com/*"); |
| 230 document_url_patterns->Append( | |
| 231 new base::StringValue("http://www.reddit.com/*")); | |
| 232 | 230 |
| 233 base::ListValue* target_url_patterns(new base::ListValue()); | 231 base::ListValue* target_url_patterns(new base::ListValue()); |
| 234 target_url_patterns->Append( | 232 target_url_patterns->AppendString("http://www.yahoo.com/*"); |
| 235 new base::StringValue("http://www.yahoo.com/*")); | 233 target_url_patterns->AppendString("http://www.facebook.com/*"); |
| 236 target_url_patterns->Append( | |
| 237 new base::StringValue("http://www.facebook.com/*")); | |
| 238 | 234 |
| 239 base::DictionaryValue value; | 235 base::DictionaryValue value; |
| 240 value.SetBoolean("incognito", incognito); | 236 value.SetBoolean("incognito", incognito); |
| 241 value.SetString("string_uid", std::string()); | 237 value.SetString("string_uid", std::string()); |
| 242 value.SetInteger("type", type); | 238 value.SetInteger("type", type); |
| 243 value.SetString("title", title); | 239 value.SetString("title", title); |
| 244 value.SetBoolean("checked", checked); | 240 value.SetBoolean("checked", checked); |
| 245 value.SetBoolean("enabled", enabled); | 241 value.SetBoolean("enabled", enabled); |
| 246 value.SetInteger("contexts", contexts_value); | 242 value.SetInteger("contexts", contexts_value); |
| 247 value.Set("document_url_patterns", document_url_patterns); | 243 value.Set("document_url_patterns", document_url_patterns); |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); | 744 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); |
| 749 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); | 745 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); |
| 750 | 746 |
| 751 // Remove all context menu items with incognito true. | 747 // Remove all context menu items with incognito true. |
| 752 manager_.RemoveAllIncognitoContextItems(); | 748 manager_.RemoveAllIncognitoContextItems(); |
| 753 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); | 749 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); |
| 754 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); | 750 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); |
| 755 } | 751 } |
| 756 | 752 |
| 757 } // namespace extensions | 753 } // namespace extensions |
| OLD | NEW |