| 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/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // Creates and returns a test Extension. The caller does *not* own the return | 80 // Creates and returns a test Extension. The caller does *not* own the return |
| 81 // value. | 81 // value. |
| 82 Extension* AddExtension(std::string name) { | 82 Extension* AddExtension(std::string name) { |
| 83 scoped_refptr<Extension> extension = prefs_.AddExtension(name); | 83 scoped_refptr<Extension> extension = prefs_.AddExtension(name); |
| 84 extensions_.push_back(extension); | 84 extensions_.push_back(extension); |
| 85 return extension.get(); | 85 return extension.get(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 TestingProfile profile_; | |
| 90 base::MessageLoopForUI message_loop_; | 89 base::MessageLoopForUI message_loop_; |
| 91 content::TestBrowserThread ui_thread_; | 90 content::TestBrowserThread ui_thread_; |
| 92 content::TestBrowserThread file_thread_; | 91 content::TestBrowserThread file_thread_; |
| 92 TestingProfile profile_; |
| 93 | 93 |
| 94 MenuManager manager_; | 94 MenuManager manager_; |
| 95 ExtensionList extensions_; | 95 ExtensionList extensions_; |
| 96 TestExtensionPrefs prefs_; | 96 TestExtensionPrefs prefs_; |
| 97 int next_id_; | 97 int next_id_; |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 DISALLOW_COPY_AND_ASSIGN(MenuManagerTest); | 100 DISALLOW_COPY_AND_ASSIGN(MenuManagerTest); |
| 101 }; | 101 }; |
| 102 | 102 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); | 751 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); |
| 752 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 752 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
| 753 | 753 |
| 754 // Remove all context menu items with incognito true. | 754 // Remove all context menu items with incognito true. |
| 755 manager_.RemoveAllIncognitoContextItems(); | 755 manager_.RemoveAllIncognitoContextItems(); |
| 756 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); | 756 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); |
| 757 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 757 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
| 758 } | 758 } |
| 759 | 759 |
| 760 } // namespace extensions | 760 } // namespace extensions |
| OLD | NEW |