OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Navigating to example.com should show the page action. | 94 // Navigating to example.com should show the page action. |
95 ui_test_utils::NavigateToURL( | 95 ui_test_utils::NavigateToURL( |
96 browser(), embedded_test_server()->GetURL( | 96 browser(), embedded_test_server()->GetURL( |
97 "example.com", "/native_bindings/simple.html")); | 97 "example.com", "/native_bindings/simple.html")); |
98 base::RunLoop().RunUntilIdle(); | 98 base::RunLoop().RunUntilIdle(); |
99 EXPECT_TRUE(page_action->GetIsVisible(tab_id)); | 99 EXPECT_TRUE(page_action->GetIsVisible(tab_id)); |
100 | 100 |
101 // And the extension should be notified of the click. | 101 // And the extension should be notified of the click. |
102 ExtensionTestMessageListener clicked_listener("clicked and removed", false); | 102 ExtensionTestMessageListener clicked_listener("clicked and removed", false); |
103 ExtensionActionAPI::Get(profile())->DispatchExtensionActionClicked( | 103 ExtensionActionAPI::Get(profile())->DispatchExtensionActionClicked( |
104 *page_action, web_contents); | 104 *page_action, web_contents, extension); |
105 ASSERT_TRUE(clicked_listener.WaitUntilSatisfied()); | 105 ASSERT_TRUE(clicked_listener.WaitUntilSatisfied()); |
106 } | 106 } |
107 | 107 |
108 IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, LazyListeners) { | 108 IN_PROC_BROWSER_TEST_F(NativeBindingsApiTest, LazyListeners) { |
109 ProcessManager::SetEventPageIdleTimeForTesting(1); | 109 ProcessManager::SetEventPageIdleTimeForTesting(1); |
110 ProcessManager::SetEventPageSuspendingTimeForTesting(1); | 110 ProcessManager::SetEventPageSuspendingTimeForTesting(1); |
111 | 111 |
112 LazyBackgroundObserver background_page_done; | 112 LazyBackgroundObserver background_page_done; |
113 const Extension* extension = LoadExtension( | 113 const Extension* extension = LoadExtension( |
114 test_data_dir_.AppendASCII("native_bindings/lazy_listeners")); | 114 test_data_dir_.AppendASCII("native_bindings/lazy_listeners")); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 ui_test_utils::NavigateToURL( | 239 ui_test_utils::NavigateToURL( |
240 browser(), embedded_test_server()->GetURL( | 240 browser(), embedded_test_server()->GetURL( |
241 "example.com", "/native_bindings/simple.html")); | 241 "example.com", "/native_bindings/simple.html")); |
242 | 242 |
243 ExtensionTestMessageListener listener("callback", false); | 243 ExtensionTestMessageListener listener("callback", false); |
244 ASSERT_TRUE(LoadExtension(test_dir.UnpackedPath())); | 244 ASSERT_TRUE(LoadExtension(test_dir.UnpackedPath())); |
245 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 245 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
246 } | 246 } |
247 | 247 |
248 } // namespace extensions | 248 } // namespace extensions |
OLD | NEW |