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

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

Issue 10514013: Filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: split out event_filter changes Created 8 years, 6 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
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
169 // Tests that the lazy background page receives the onInstalled event and shuts 185 // Tests that the lazy background page receives the onInstalled event and shuts
170 // down. 186 // down.
171 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnInstalled) { 187 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnInstalled) {
172 ResultCatcher catcher; 188 ResultCatcher catcher;
173 ASSERT_TRUE(LoadExtensionAndWait("on_installed")); 189 ASSERT_TRUE(LoadExtensionAndWait("on_installed"));
174 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 190 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
175 191
176 // Lazy Background Page has been shut down. 192 // Lazy Background Page has been shut down.
177 ExtensionProcessManager* pm = 193 ExtensionProcessManager* pm =
178 browser()->profile()->GetExtensionProcessManager(); 194 browser()->profile()->GetExtensionProcessManager();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); 368 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
353 369
354 // The browser action has a new title. 370 // The browser action has a new title.
355 BrowserActionTestUtil browser_action(browser()); 371 BrowserActionTestUtil browser_action(browser());
356 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); 372 ASSERT_EQ(1, browser_action.NumberOfBrowserActions());
357 EXPECT_EQ("Success", browser_action.GetTooltip(0)); 373 EXPECT_EQ("Success", browser_action.GetTooltip(0));
358 } 374 }
359 375
360 // TODO: background page with timer. 376 // TODO: background page with timer.
361 // TODO: background page that interacts with popup. 377 // TODO: background page that interacts with popup.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698