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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); | 471 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); |
472 }; | 472 }; |
473 | 473 |
474 // A mock ExtensionSystem to serve our MockEventRouter. | 474 // A mock ExtensionSystem to serve our MockEventRouter. |
475 class MockExtensionSystem : public TestExtensionSystem { | 475 class MockExtensionSystem : public TestExtensionSystem { |
476 public: | 476 public: |
477 explicit MockExtensionSystem(Profile* profile) | 477 explicit MockExtensionSystem(Profile* profile) |
478 : TestExtensionSystem(profile) {} | 478 : TestExtensionSystem(profile) {} |
479 | 479 |
480 virtual EventRouter* event_router() OVERRIDE { | 480 virtual EventRouter* event_router() OVERRIDE { |
481 if (!mock_event_router_.get()) | 481 if (!mock_event_router_) |
482 mock_event_router_.reset(new MockEventRouter(profile_)); | 482 mock_event_router_.reset(new MockEventRouter(profile_)); |
483 return mock_event_router_.get(); | 483 return mock_event_router_.get(); |
484 } | 484 } |
485 | 485 |
486 private: | 486 private: |
487 scoped_ptr<MockEventRouter> mock_event_router_; | 487 scoped_ptr<MockEventRouter> mock_event_router_; |
488 | 488 |
489 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); | 489 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); |
490 }; | 490 }; |
491 | 491 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); | 747 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); |
748 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 748 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
749 | 749 |
750 // Remove all context menu items with incognito true. | 750 // Remove all context menu items with incognito true. |
751 manager_.RemoveAllIncognitoContextItems(); | 751 manager_.RemoveAllIncognitoContextItems(); |
752 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); | 752 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); |
753 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 753 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
754 } | 754 } |
755 | 755 |
756 } // namespace extensions | 756 } // namespace extensions |
OLD | NEW |