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

Side by Side Diff: chrome/browser/devtools/devtools_sanity_browsertest.cc

Issue 1016473002: Make LoadMonitoringExtensionHostQueue remove itself as an ExtensionHost observer at the correct tim… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another rename Created 5 years, 9 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
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/bind.h" 5 #include "base/bind.h"
6 #include "base/cancelable_callback.h" 6 #include "base/cancelable_callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return WaitForExtensionViewsToLoad(); 343 return WaitForExtensionViewsToLoad();
344 } 344 }
345 345
346 bool WaitForExtensionViewsToLoad() { 346 bool WaitForExtensionViewsToLoad() {
347 // Wait for all the extension render views that exist to finish loading. 347 // Wait for all the extension render views that exist to finish loading.
348 // NOTE: This assumes that the extension views list is not changing while 348 // NOTE: This assumes that the extension views list is not changing while
349 // this method is running. 349 // this method is running.
350 350
351 content::NotificationRegistrar registrar; 351 content::NotificationRegistrar registrar;
352 registrar.Add(this, 352 registrar.Add(this,
353 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 353 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD,
354 content::NotificationService::AllSources()); 354 content::NotificationService::AllSources());
355 base::CancelableClosure timeout( 355 base::CancelableClosure timeout(
356 base::Bind(&TimeoutCallback, "Extension host load timed out.")); 356 base::Bind(&TimeoutCallback, "Extension host load timed out."));
357 base::MessageLoop::current()->PostDelayedTask( 357 base::MessageLoop::current()->PostDelayedTask(
358 FROM_HERE, timeout.callback(), TestTimeouts::action_timeout()); 358 FROM_HERE, timeout.callback(), TestTimeouts::action_timeout());
359 359
360 extensions::ProcessManager* manager = 360 extensions::ProcessManager* manager =
361 extensions::ProcessManager::Get(browser()->profile()); 361 extensions::ProcessManager::Get(browser()->profile());
362 extensions::ProcessManager::ViewSet all_views = manager->GetAllViews(); 362 extensions::ProcessManager::ViewSet all_views = manager->GetAllViews();
363 for (extensions::ProcessManager::ViewSet::const_iterator iter = 363 for (extensions::ProcessManager::ViewSet::const_iterator iter =
364 all_views.begin(); 364 all_views.begin();
365 iter != all_views.end();) { 365 iter != all_views.end();) {
366 if (!(*iter)->IsLoading()) 366 if (!(*iter)->IsLoading())
367 ++iter; 367 ++iter;
368 else 368 else
369 content::RunMessageLoop(); 369 content::RunMessageLoop();
370 } 370 }
371 371
372 timeout.Cancel(); 372 timeout.Cancel();
373 return true; 373 return true;
374 } 374 }
375 375
376 void Observe(int type, 376 void Observe(int type,
377 const content::NotificationSource& source, 377 const content::NotificationSource& source,
378 const content::NotificationDetails& details) override { 378 const content::NotificationDetails& details) override {
379 switch (type) { 379 switch (type) {
380 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: 380 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED:
381 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: 381 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD:
382 base::MessageLoopForUI::current()->Quit(); 382 base::MessageLoopForUI::current()->Quit();
383 break; 383 break;
384 default: 384 default:
385 NOTREACHED(); 385 NOTREACHED();
386 break; 386 break;
387 } 387 }
388 } 388 }
389 389
390 base::FilePath test_extensions_dir_; 390 base::FilePath test_extensions_dir_;
391 }; 391 };
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDevToolsDisabled, true); 961 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDevToolsDisabled, true);
962 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 962 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
963 content::WebContents* web_contents = 963 content::WebContents* web_contents =
964 browser()->tab_strip_model()->GetWebContentsAt(0); 964 browser()->tab_strip_model()->GetWebContentsAt(0);
965 scoped_refptr<content::DevToolsAgentHost> agent( 965 scoped_refptr<content::DevToolsAgentHost> agent(
966 content::DevToolsAgentHost::GetOrCreateFor(web_contents)); 966 content::DevToolsAgentHost::GetOrCreateFor(web_contents));
967 DevToolsWindow::OpenDevToolsWindow(web_contents); 967 DevToolsWindow::OpenDevToolsWindow(web_contents);
968 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(agent.get()); 968 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(agent.get());
969 ASSERT_FALSE(window); 969 ASSERT_FALSE(window);
970 } 970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698