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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/scoped_temp_dir.h" 13 #include "base/scoped_temp_dir.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "chrome/browser/extensions/crx_installer.h" 15 #include "chrome/browser/extensions/crx_installer.h"
16 #include "chrome/browser/extensions/extension_creator.h" 16 #include "chrome/browser/extensions/extension_creator.h"
17 #include "chrome/browser/extensions/extension_error_reporter.h" 17 #include "chrome/browser/extensions/extension_error_reporter.h"
18 #include "chrome/browser/extensions/extension_host.h" 18 #include "chrome/browser/extensions/extension_host.h"
19 #include "chrome/browser/extensions/extension_install_ui.h" 19 #include "chrome/browser/extensions/extension_install_ui.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/browser/ui/omnibox/location_bar.h" 24 #include "chrome/browser/ui/omnibox/location_bar.h"
25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
27 #include "chrome/test/ui_test_utils.h" 28 #include "chrome/test/ui_test_utils.h"
28 #include "content/common/notification_registrar.h" 29 #include "content/common/notification_registrar.h"
29 #include "content/common/notification_service.h" 30 #include "content/common/notification_service.h"
30 #include "content/common/notification_type.h"
31 31
32 ExtensionBrowserTest::ExtensionBrowserTest() 32 ExtensionBrowserTest::ExtensionBrowserTest()
33 : loaded_(false), 33 : loaded_(false),
34 installed_(false), 34 installed_(false),
35 extension_installs_observed_(0), 35 extension_installs_observed_(0),
36 target_page_action_count_(-1), 36 target_page_action_count_(-1),
37 target_visible_page_action_count_(-1) { 37 target_visible_page_action_count_(-1) {
38 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 38 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
39 } 39 }
40 40
(...skipping 16 matching lines...) Expand all
57 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 57 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
58 command_line->AppendSwitch(switches::kNoFirstRun); 58 command_line->AppendSwitch(switches::kNoFirstRun);
59 #endif 59 #endif
60 } 60 }
61 61
62 const Extension* ExtensionBrowserTest::LoadExtensionImpl( 62 const Extension* ExtensionBrowserTest::LoadExtensionImpl(
63 const FilePath& path, bool incognito_enabled, bool fileaccess_enabled) { 63 const FilePath& path, bool incognito_enabled, bool fileaccess_enabled) {
64 ExtensionService* service = browser()->profile()->GetExtensionService(); 64 ExtensionService* service = browser()->profile()->GetExtensionService();
65 { 65 {
66 NotificationRegistrar registrar; 66 NotificationRegistrar registrar;
67 registrar.Add(this, NotificationType::EXTENSION_LOADED, 67 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
68 NotificationService::AllSources()); 68 NotificationService::AllSources());
69 service->LoadExtension(path); 69 service->LoadExtension(path);
70 ui_test_utils::RunMessageLoop(); 70 ui_test_utils::RunMessageLoop();
71 } 71 }
72 72
73 // Find the extension by iterating backwards since it is likely last. 73 // Find the extension by iterating backwards since it is likely last.
74 FilePath extension_path = path; 74 FilePath extension_path = path;
75 file_util::AbsolutePath(&extension_path); 75 file_util::AbsolutePath(&extension_path);
76 const Extension* extension = NULL; 76 const Extension* extension = NULL;
77 for (ExtensionList::const_reverse_iterator iter = 77 for (ExtensionList::const_reverse_iterator iter =
78 service->extensions()->rbegin(); 78 service->extensions()->rbegin();
79 iter != service->extensions()->rend(); ++iter) { 79 iter != service->extensions()->rend(); ++iter) {
80 if ((*iter)->path() == extension_path) { 80 if ((*iter)->path() == extension_path) {
81 extension = *iter; 81 extension = *iter;
82 break; 82 break;
83 } 83 }
84 } 84 }
85 if (!extension) 85 if (!extension)
86 return NULL; 86 return NULL;
87 87
88 const std::string extension_id = extension->id(); 88 const std::string extension_id = extension->id();
89 89
90 // The call to OnExtensionInstalled ensures the other extension prefs 90 // The call to OnExtensionInstalled ensures the other extension prefs
91 // are set up with the defaults. 91 // are set up with the defaults.
92 service->extension_prefs()->OnExtensionInstalled( 92 service->extension_prefs()->OnExtensionInstalled(
93 extension, Extension::ENABLED); 93 extension, Extension::ENABLED);
94 service->SetIsIncognitoEnabled(extension_id, incognito_enabled); 94 service->SetIsIncognitoEnabled(extension_id, incognito_enabled);
95 95
96 ui_test_utils::WindowedNotificationObserver extension_loaded_signal( 96 ui_test_utils::WindowedNotificationObserver extension_loaded_signal(
97 NotificationType::EXTENSION_LOADED, 97 chrome::NOTIFICATION_EXTENSION_LOADED,
98 Source<Profile>(browser()->profile())); 98 Source<Profile>(browser()->profile()));
99 service->SetAllowFileAccess(extension, fileaccess_enabled); 99 service->SetAllowFileAccess(extension, fileaccess_enabled);
100 100
101 // Disabling file access (it's enabled by default for unpacked extensions) 101 // Disabling file access (it's enabled by default for unpacked extensions)
102 // ends up reloading the extension, so we need to wait for that and make sure 102 // ends up reloading the extension, so we need to wait for that and make sure
103 // that we have the most up to date extension instance. 103 // that we have the most up to date extension instance.
104 if (!fileaccess_enabled) { 104 if (!fileaccess_enabled) {
105 extension_loaded_signal.Wait(); 105 extension_loaded_signal.Wait();
106 extension = service->GetExtensionById(extension_id, false); 106 extension = service->GetExtensionById(extension_id, false);
107 CHECK(extension) << extension_id << " not found after reloading."; 107 CHECK(extension) << extension_id << " not found after reloading.";
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 const FilePath& path, 219 const FilePath& path,
220 InstallUIType ui_type, 220 InstallUIType ui_type,
221 int expected_change, 221 int expected_change,
222 Profile* profile) { 222 Profile* profile) {
223 ExtensionService* service = profile->GetExtensionService(); 223 ExtensionService* service = profile->GetExtensionService();
224 service->set_show_extensions_prompts(false); 224 service->set_show_extensions_prompts(false);
225 size_t num_before = service->extensions()->size(); 225 size_t num_before = service->extensions()->size();
226 226
227 { 227 {
228 NotificationRegistrar registrar; 228 NotificationRegistrar registrar;
229 registrar.Add(this, NotificationType::EXTENSION_LOADED, 229 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
230 NotificationService::AllSources()); 230 NotificationService::AllSources());
231 registrar.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, 231 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
232 NotificationService::AllSources()); 232 NotificationService::AllSources());
233 registrar.Add(this, NotificationType::EXTENSION_INSTALL_ERROR, 233 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
234 NotificationService::AllSources()); 234 NotificationService::AllSources());
235 235
236 ExtensionInstallUI* install_ui = NULL; 236 ExtensionInstallUI* install_ui = NULL;
237 if (ui_type == INSTALL_UI_TYPE_CANCEL) 237 if (ui_type == INSTALL_UI_TYPE_CANCEL)
238 install_ui = new MockAbortExtensionInstallUI(); 238 install_ui = new MockAbortExtensionInstallUI();
239 else if (ui_type == INSTALL_UI_TYPE_NORMAL) 239 else if (ui_type == INSTALL_UI_TYPE_NORMAL)
240 install_ui = new ExtensionInstallUI(profile); 240 install_ui = new ExtensionInstallUI(profile);
241 else if (ui_type == INSTALL_UI_TYPE_AUTO_CONFIRM) 241 else if (ui_type == INSTALL_UI_TYPE_AUTO_CONFIRM)
242 install_ui = new MockAutoConfirmExtensionInstallUI(profile); 242 install_ui = new MockAutoConfirmExtensionInstallUI(profile);
243 243
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return false; 277 return false;
278 } 278 }
279 279
280 return WaitForExtensionHostsToLoad(); 280 return WaitForExtensionHostsToLoad();
281 } 281 }
282 282
283 void ExtensionBrowserTest::ReloadExtension(const std::string& extension_id) { 283 void ExtensionBrowserTest::ReloadExtension(const std::string& extension_id) {
284 ExtensionService* service = browser()->profile()->GetExtensionService(); 284 ExtensionService* service = browser()->profile()->GetExtensionService();
285 service->ReloadExtension(extension_id); 285 service->ReloadExtension(extension_id);
286 ui_test_utils::RegisterAndWait(this, 286 ui_test_utils::RegisterAndWait(this,
287 NotificationType::EXTENSION_LOADED, 287 chrome::NOTIFICATION_EXTENSION_LOADED,
288 NotificationService::AllSources()); 288 NotificationService::AllSources());
289 } 289 }
290 290
291 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { 291 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) {
292 ExtensionService* service = browser()->profile()->GetExtensionService(); 292 ExtensionService* service = browser()->profile()->GetExtensionService();
293 service->UnloadExtension(extension_id, UnloadedExtensionInfo::DISABLE); 293 service->UnloadExtension(extension_id, UnloadedExtensionInfo::DISABLE);
294 } 294 }
295 295
296 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { 296 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) {
297 ExtensionService* service = browser()->profile()->GetExtensionService(); 297 ExtensionService* service = browser()->profile()->GetExtensionService();
298 service->UninstallExtension(extension_id, false, NULL); 298 service->UninstallExtension(extension_id, false, NULL);
299 } 299 }
300 300
301 void ExtensionBrowserTest::DisableExtension(const std::string& extension_id) { 301 void ExtensionBrowserTest::DisableExtension(const std::string& extension_id) {
302 ExtensionService* service = browser()->profile()->GetExtensionService(); 302 ExtensionService* service = browser()->profile()->GetExtensionService();
303 service->DisableExtension(extension_id); 303 service->DisableExtension(extension_id);
304 } 304 }
305 305
306 void ExtensionBrowserTest::EnableExtension(const std::string& extension_id) { 306 void ExtensionBrowserTest::EnableExtension(const std::string& extension_id) {
307 ExtensionService* service = browser()->profile()->GetExtensionService(); 307 ExtensionService* service = browser()->profile()->GetExtensionService();
308 service->EnableExtension(extension_id); 308 service->EnableExtension(extension_id);
309 } 309 }
310 310
311 bool ExtensionBrowserTest::WaitForPageActionCountChangeTo(int count) { 311 bool ExtensionBrowserTest::WaitForPageActionCountChangeTo(int count) {
312 LocationBarTesting* location_bar = 312 LocationBarTesting* location_bar =
313 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 313 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
314 if (location_bar->PageActionCount() != count) { 314 if (location_bar->PageActionCount() != count) {
315 target_page_action_count_ = count; 315 target_page_action_count_ = count;
316 ui_test_utils::RegisterAndWait(this, 316 ui_test_utils::RegisterAndWait(this,
317 NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, 317 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
318 NotificationService::AllSources()); 318 NotificationService::AllSources());
319 } 319 }
320 return location_bar->PageActionCount() == count; 320 return location_bar->PageActionCount() == count;
321 } 321 }
322 322
323 bool ExtensionBrowserTest::WaitForPageActionVisibilityChangeTo(int count) { 323 bool ExtensionBrowserTest::WaitForPageActionVisibilityChangeTo(int count) {
324 LocationBarTesting* location_bar = 324 LocationBarTesting* location_bar =
325 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 325 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
326 if (location_bar->PageActionVisibleCount() != count) { 326 if (location_bar->PageActionVisibleCount() != count) {
327 target_visible_page_action_count_ = count; 327 target_visible_page_action_count_ = count;
328 ui_test_utils::RegisterAndWait(this, 328 ui_test_utils::RegisterAndWait(this,
329 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, 329 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
330 NotificationService::AllSources()); 330 NotificationService::AllSources());
331 } 331 }
332 return location_bar->PageActionVisibleCount() == count; 332 return location_bar->PageActionVisibleCount() == count;
333 } 333 }
334 334
335 bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() { 335 bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() {
336 // Wait for all the extension hosts that exist to finish loading. 336 // Wait for all the extension hosts that exist to finish loading.
337 NotificationRegistrar registrar; 337 NotificationRegistrar registrar;
338 registrar.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, 338 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
339 NotificationService::AllSources()); 339 NotificationService::AllSources());
340 340
341 ExtensionProcessManager* manager = 341 ExtensionProcessManager* manager =
342 browser()->profile()->GetExtensionProcessManager(); 342 browser()->profile()->GetExtensionProcessManager();
343 for (ExtensionProcessManager::const_iterator iter = manager->begin(); 343 for (ExtensionProcessManager::const_iterator iter = manager->begin();
344 iter != manager->end();) { 344 iter != manager->end();) {
345 if ((*iter)->did_stop_loading()) { 345 if ((*iter)->did_stop_loading()) {
346 ++iter; 346 ++iter;
347 } else { 347 } else {
348 ui_test_utils::RunMessageLoop(); 348 ui_test_utils::RunMessageLoop();
349 349
350 // Test activity may have modified the set of extension processes during 350 // Test activity may have modified the set of extension processes during
351 // message processing, so re-start the iteration to catch added/removed 351 // message processing, so re-start the iteration to catch added/removed
352 // processes. 352 // processes.
353 iter = manager->begin(); 353 iter = manager->begin();
354 } 354 }
355 } 355 }
356 return true; 356 return true;
357 } 357 }
358 358
359 bool ExtensionBrowserTest::WaitForExtensionInstall() { 359 bool ExtensionBrowserTest::WaitForExtensionInstall() {
360 int before = extension_installs_observed_; 360 int before = extension_installs_observed_;
361 ui_test_utils::RegisterAndWait(this, NotificationType::EXTENSION_INSTALLED, 361 ui_test_utils::RegisterAndWait(this,
362 chrome::NOTIFICATION_EXTENSION_INSTALLED,
362 NotificationService::AllSources()); 363 NotificationService::AllSources());
363 return extension_installs_observed_ == (before + 1); 364 return extension_installs_observed_ == (before + 1);
364 } 365 }
365 366
366 bool ExtensionBrowserTest::WaitForExtensionInstallError() { 367 bool ExtensionBrowserTest::WaitForExtensionInstallError() {
367 int before = extension_installs_observed_; 368 int before = extension_installs_observed_;
368 ui_test_utils::RegisterAndWait(this, 369 ui_test_utils::RegisterAndWait(this,
369 NotificationType::EXTENSION_INSTALL_ERROR, 370 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
370 NotificationService::AllSources()); 371 NotificationService::AllSources());
371 return extension_installs_observed_ == before; 372 return extension_installs_observed_ == before;
372 } 373 }
373 374
374 void ExtensionBrowserTest::WaitForExtensionLoad() { 375 void ExtensionBrowserTest::WaitForExtensionLoad() {
375 ui_test_utils::RegisterAndWait(this, NotificationType::EXTENSION_LOADED, 376 ui_test_utils::RegisterAndWait(this, chrome::NOTIFICATION_EXTENSION_LOADED,
376 NotificationService::AllSources()); 377 NotificationService::AllSources());
377 WaitForExtensionHostsToLoad(); 378 WaitForExtensionHostsToLoad();
378 } 379 }
379 380
380 bool ExtensionBrowserTest::WaitForExtensionCrash( 381 bool ExtensionBrowserTest::WaitForExtensionCrash(
381 const std::string& extension_id) { 382 const std::string& extension_id) {
382 ExtensionService* service = browser()->profile()->GetExtensionService(); 383 ExtensionService* service = browser()->profile()->GetExtensionService();
383 384
384 if (!service->GetExtensionById(extension_id, true)) { 385 if (!service->GetExtensionById(extension_id, true)) {
385 // The extension is already unloaded, presumably due to a crash. 386 // The extension is already unloaded, presumably due to a crash.
386 return true; 387 return true;
387 } 388 }
388 ui_test_utils::RegisterAndWait(this, 389 ui_test_utils::RegisterAndWait(
389 NotificationType::EXTENSION_PROCESS_TERMINATED, 390 this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
390 NotificationService::AllSources()); 391 NotificationService::AllSources());
391 return (service->GetExtensionById(extension_id, true) == NULL); 392 return (service->GetExtensionById(extension_id, true) == NULL);
392 } 393 }
393 394
394 void ExtensionBrowserTest::Observe(NotificationType type, 395 void ExtensionBrowserTest::Observe(int type,
395 const NotificationSource& source, 396 const NotificationSource& source,
396 const NotificationDetails& details) { 397 const NotificationDetails& details) {
397 switch (type.value) { 398 switch (type) {
398 case NotificationType::EXTENSION_LOADED: 399 case chrome::NOTIFICATION_EXTENSION_LOADED:
399 last_loaded_extension_id_ = Details<const Extension>(details).ptr()->id(); 400 last_loaded_extension_id_ = Details<const Extension>(details).ptr()->id();
400 VLOG(1) << "Got EXTENSION_LOADED notification."; 401 VLOG(1) << "Got EXTENSION_LOADED notification.";
401 MessageLoopForUI::current()->Quit(); 402 MessageLoopForUI::current()->Quit();
402 break; 403 break;
403 404
404 case NotificationType::EXTENSION_UPDATE_DISABLED: 405 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED:
405 VLOG(1) << "Got EXTENSION_UPDATE_DISABLED notification."; 406 VLOG(1) << "Got EXTENSION_UPDATE_DISABLED notification.";
406 MessageLoopForUI::current()->Quit(); 407 MessageLoopForUI::current()->Quit();
407 break; 408 break;
408 409
409 case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: 410 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING:
410 VLOG(1) << "Got EXTENSION_HOST_DID_STOP_LOADING notification."; 411 VLOG(1) << "Got EXTENSION_HOST_DID_STOP_LOADING notification.";
411 MessageLoopForUI::current()->Quit(); 412 MessageLoopForUI::current()->Quit();
412 break; 413 break;
413 414
414 case NotificationType::EXTENSION_INSTALLED: 415 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
415 VLOG(1) << "Got EXTENSION_INSTALLED notification."; 416 VLOG(1) << "Got EXTENSION_INSTALLED notification.";
416 ++extension_installs_observed_; 417 ++extension_installs_observed_;
417 MessageLoopForUI::current()->Quit(); 418 MessageLoopForUI::current()->Quit();
418 break; 419 break;
419 420
420 case NotificationType::EXTENSION_INSTALL_ERROR: 421 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR:
421 VLOG(1) << "Got EXTENSION_INSTALL_ERROR notification."; 422 VLOG(1) << "Got EXTENSION_INSTALL_ERROR notification.";
422 MessageLoopForUI::current()->Quit(); 423 MessageLoopForUI::current()->Quit();
423 break; 424 break;
424 425
425 case NotificationType::EXTENSION_PROCESS_CREATED: 426 case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED:
426 VLOG(1) << "Got EXTENSION_PROCESS_CREATED notification."; 427 VLOG(1) << "Got EXTENSION_PROCESS_CREATED notification.";
427 MessageLoopForUI::current()->Quit(); 428 MessageLoopForUI::current()->Quit();
428 break; 429 break;
429 430
430 case NotificationType::EXTENSION_PROCESS_TERMINATED: 431 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED:
431 VLOG(1) << "Got EXTENSION_PROCESS_TERMINATED notification."; 432 VLOG(1) << "Got EXTENSION_PROCESS_TERMINATED notification.";
432 MessageLoopForUI::current()->Quit(); 433 MessageLoopForUI::current()->Quit();
433 break; 434 break;
434 435
435 case NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED: { 436 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED: {
436 LocationBarTesting* location_bar = 437 LocationBarTesting* location_bar =
437 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 438 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
438 VLOG(1) << "Got EXTENSION_PAGE_ACTION_COUNT_CHANGED notification. Number " 439 VLOG(1) << "Got EXTENSION_PAGE_ACTION_COUNT_CHANGED notification. Number "
439 "of page actions: " << location_bar->PageActionCount(); 440 "of page actions: " << location_bar->PageActionCount();
440 if (location_bar->PageActionCount() == 441 if (location_bar->PageActionCount() ==
441 target_page_action_count_) { 442 target_page_action_count_) {
442 target_page_action_count_ = -1; 443 target_page_action_count_ = -1;
443 MessageLoopForUI::current()->Quit(); 444 MessageLoopForUI::current()->Quit();
444 } 445 }
445 break; 446 break;
446 } 447 }
447 448
448 case NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { 449 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: {
449 LocationBarTesting* location_bar = 450 LocationBarTesting* location_bar =
450 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 451 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
451 VLOG(1) << "Got EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED notification. " 452 VLOG(1) << "Got EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED notification. "
452 "Number of visible page actions: " 453 "Number of visible page actions: "
453 << location_bar->PageActionVisibleCount(); 454 << location_bar->PageActionVisibleCount();
454 if (location_bar->PageActionVisibleCount() == 455 if (location_bar->PageActionVisibleCount() ==
455 target_visible_page_action_count_) { 456 target_visible_page_action_count_) {
456 target_visible_page_action_count_ = -1; 457 target_visible_page_action_count_ = -1;
457 MessageLoopForUI::current()->Quit(); 458 MessageLoopForUI::current()->Quit();
458 } 459 }
459 break; 460 break;
460 } 461 }
461 462
462 default: 463 default:
463 NOTREACHED(); 464 NOTREACHED();
464 break; 465 break;
465 } 466 }
466 } 467 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.h ('k') | chrome/browser/extensions/extension_cookies_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698