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.h" | 10 #include "base/message_loop.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 using testing::DeleteArg; | 36 using testing::DeleteArg; |
37 using testing::InSequence; | 37 using testing::InSequence; |
38 using testing::Return; | 38 using testing::Return; |
39 using testing::SaveArg; | 39 using testing::SaveArg; |
40 | 40 |
41 namespace extensions { | 41 namespace extensions { |
42 | 42 |
43 // Base class for tests. | 43 // Base class for tests. |
44 class MenuManagerTest : public testing::Test { | 44 class MenuManagerTest : public testing::Test { |
45 public: | 45 public: |
46 MenuManagerTest() : ui_thread_(BrowserThread::UI, &message_loop_), | 46 MenuManagerTest() |
47 file_thread_(BrowserThread::FILE, &message_loop_), | 47 : ui_thread_(BrowserThread::UI, &message_loop_), |
48 manager_(&profile_), | 48 file_thread_(BrowserThread::FILE, &message_loop_), |
49 prefs_(message_loop_.message_loop_proxy()), | 49 manager_(&profile_), |
50 next_id_(1) { | 50 prefs_(message_loop_.message_loop_proxy().get()), |
51 } | 51 next_id_(1) {} |
52 | 52 |
53 virtual void TearDown() OVERRIDE { | 53 virtual void TearDown() OVERRIDE { |
54 prefs_.pref_service()->CommitPendingWrite(); | 54 prefs_.pref_service()->CommitPendingWrite(); |
55 message_loop_.RunUntilIdle(); | 55 message_loop_.RunUntilIdle(); |
56 } | 56 } |
57 | 57 |
58 // Returns a test item. | 58 // Returns a test item. |
59 MenuItem* CreateTestItem(Extension* extension, bool incognito = false) { | 59 MenuItem* CreateTestItem(Extension* extension, bool incognito = false) { |
60 MenuItem::Type type = MenuItem::NORMAL; | 60 MenuItem::Type type = MenuItem::NORMAL; |
61 MenuItem::ContextList contexts(MenuItem::ALL); | 61 MenuItem::ContextList contexts(MenuItem::ALL); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); | 748 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); |
749 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 749 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
750 | 750 |
751 // Remove all context menu items with incognito true. | 751 // Remove all context menu items with incognito true. |
752 manager_.RemoveAllIncognitoContextItems(); | 752 manager_.RemoveAllIncognitoContextItems(); |
753 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); | 753 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); |
754 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 754 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
755 } | 755 } |
756 | 756 |
757 } // namespace extensions | 757 } // namespace extensions |
OLD | NEW |