Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Side by Side Diff: chrome/browser/extensions/lazy_background_page_apitest.cc

Issue 10661038: Revert 143896 - Filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:mergeinfo
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h" 8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/extensions/browser_action_test_util.h" 9 #include "chrome/browser/extensions/browser_action_test_util.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); 160 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
161 161
162 // Page action is shown. 162 // Page action is shown.
163 page_action_changed.Wait(); 163 page_action_changed.Wait();
164 EXPECT_EQ(num_page_actions + 1, 164 EXPECT_EQ(num_page_actions + 1,
165 browser()->window()->GetLocationBar()-> 165 browser()->window()->GetLocationBar()->
166 GetLocationBarForTesting()->PageActionVisibleCount()); 166 GetLocationBarForTesting()->PageActionVisibleCount());
167 } 167 }
168 168
169 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Filters) {
170 const Extension* extension = LoadExtensionAndWait("filters");
171 ASSERT_TRUE(extension);
172
173 // Lazy Background Page doesn't exist yet.
174 ExtensionProcessManager* pm =
175 browser()->profile()->GetExtensionProcessManager();
176 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
177
178 // Open a tab to a URL that will fire a webNavigation event.
179 LazyBackgroundObserver page_complete;
180 ui_test_utils::NavigateToURL(
181 browser(), test_server()->GetURL("files/extensions/test_file.html"));
182 page_complete.Wait();
183 }
184
185 // Tests that the lazy background page receives the onInstalled event and shuts 169 // Tests that the lazy background page receives the onInstalled event and shuts
186 // down. 170 // down.
187 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnInstalled) { 171 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnInstalled) {
188 ResultCatcher catcher; 172 ResultCatcher catcher;
189 ASSERT_TRUE(LoadExtensionAndWait("on_installed")); 173 ASSERT_TRUE(LoadExtensionAndWait("on_installed"));
190 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 174 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
191 175
192 // Lazy Background Page has been shut down. 176 // Lazy Background Page has been shut down.
193 ExtensionProcessManager* pm = 177 ExtensionProcessManager* pm =
194 browser()->profile()->GetExtensionProcessManager(); 178 browser()->profile()->GetExtensionProcessManager();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); 352 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
369 353
370 // The browser action has a new title. 354 // The browser action has a new title.
371 BrowserActionTestUtil browser_action(browser()); 355 BrowserActionTestUtil browser_action(browser());
372 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); 356 ASSERT_EQ(1, browser_action.NumberOfBrowserActions());
373 EXPECT_EQ("Success", browser_action.GetTooltip(0)); 357 EXPECT_EQ("Success", browser_action.GetTooltip(0));
374 } 358 }
375 359
376 // TODO: background page with timer. 360 // TODO: background page with timer.
377 // TODO: background page that interacts with popup. 361 // TODO: background page that interacts with popup.
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_processes_api.cc ('k') | chrome/browser/extensions/system/system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698