| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 MOCK_METHOD6(DispatchEventToExtensionMock, | 451 MOCK_METHOD6(DispatchEventToExtensionMock, |
| 452 void(const std::string& extension_id, | 452 void(const std::string& extension_id, |
| 453 const std::string& event_name, | 453 const std::string& event_name, |
| 454 base::ListValue* event_args, | 454 base::ListValue* event_args, |
| 455 Profile* source_profile, | 455 Profile* source_profile, |
| 456 const GURL& event_url, | 456 const GURL& event_url, |
| 457 EventRouter::UserGestureState state)); | 457 EventRouter::UserGestureState state)); |
| 458 | 458 |
| 459 virtual void DispatchEventToExtension(const std::string& extension_id, | 459 virtual void DispatchEventToExtension(const std::string& extension_id, |
| 460 const std::string& event_name, | 460 scoped_ptr<Event> event) { |
| 461 scoped_ptr<base::ListValue> event_args, | 461 DispatchEventToExtensionMock(extension_id, |
| 462 Profile* source_profile, | 462 event->event_name, |
| 463 const GURL& event_url, | 463 event->event_args.release(), |
| 464 EventRouter::UserGestureState state) { | 464 event->restrict_to_profile, |
| 465 DispatchEventToExtensionMock(extension_id, event_name, event_args.release(), | 465 event->event_url, |
| 466 source_profile, event_url, state); | 466 event->user_gesture); |
| 467 } | 467 } |
| 468 | 468 |
| 469 private: | 469 private: |
| 470 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); | 470 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); |
| 471 }; | 471 }; |
| 472 | 472 |
| 473 // A mock ExtensionSystem to serve our MockEventRouter. | 473 // A mock ExtensionSystem to serve our MockEventRouter. |
| 474 class MockExtensionSystem : public TestExtensionSystem { | 474 class MockExtensionSystem : public TestExtensionSystem { |
| 475 public: | 475 public: |
| 476 explicit MockExtensionSystem(Profile* profile) | 476 explicit MockExtensionSystem(Profile* profile) |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); | 741 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); |
| 742 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 742 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
| 743 | 743 |
| 744 // Remove all context menu items with incognito true. | 744 // Remove all context menu items with incognito true. |
| 745 manager_.RemoveAllIncognitoContextItems(); | 745 manager_.RemoveAllIncognitoContextItems(); |
| 746 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); | 746 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); |
| 747 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); | 747 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); |
| 748 } | 748 } |
| 749 | 749 |
| 750 } // namespace extensions | 750 } // namespace extensions |
| OLD | NEW |