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

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

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added printfs to debug timeout which doesn't happen locally 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 "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"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 CHECK(service->AllowFileAccess(extension)); 132 CHECK(service->AllowFileAccess(extension));
133 133
134 if (!fileaccess_enabled) { 134 if (!fileaccess_enabled) {
135 service->SetAllowFileAccess(extension, fileaccess_enabled); 135 service->SetAllowFileAccess(extension, fileaccess_enabled);
136 load_signal.Wait(); 136 load_signal.Wait();
137 extension = service->GetExtensionById(extension_id, false); 137 extension = service->GetExtensionById(extension_id, false);
138 CHECK(extension) << extension_id << " not found after reloading."; 138 CHECK(extension) << extension_id << " not found after reloading.";
139 } 139 }
140 } 140 }
141 141
142 // After chrome::NOTIFICATION_EXTENSION_LOADED there are still remaining tasks
143 // that need to complete for extensions to be in a settled load state.
144 ui_test_utils::RunAllPendingInMessageLoop();
145
142 if (!WaitForExtensionViewsToLoad()) 146 if (!WaitForExtensionViewsToLoad())
143 return NULL; 147 return NULL;
144 148
145 return extension; 149 return extension;
146 } 150 }
147 151
148 const Extension* ExtensionBrowserTest::LoadExtension(const FilePath& path) { 152 const Extension* ExtensionBrowserTest::LoadExtension(const FilePath& path) {
149 return LoadExtensionWithOptions(path, false, true); 153 return LoadExtensionWithOptions(path, false, true);
150 } 154 }
151 155
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 FilePath crx_path = path; 300 FilePath crx_path = path;
297 if (crx_path.Extension() != FILE_PATH_LITERAL(".crx")) { 301 if (crx_path.Extension() != FILE_PATH_LITERAL(".crx")) {
298 crx_path = PackExtension(path); 302 crx_path = PackExtension(path);
299 } 303 }
300 if (crx_path.empty()) 304 if (crx_path.empty())
301 return NULL; 305 return NULL;
302 306
303 scoped_refptr<CrxInstaller> installer( 307 scoped_refptr<CrxInstaller> installer(
304 CrxInstaller::Create(service, install_ui)); 308 CrxInstaller::Create(service, install_ui));
305 installer->set_expected_id(id); 309 installer->set_expected_id(id);
306 installer->set_allow_off_store_install(true); 310 installer->set_allow_off_store_install(true);
jar (doing other things) 2012/06/14 04:50:29 nit: I couldn't guess what this method does. I su
jbates 2012/06/15 02:20:38 I'm just in here to fix some flakiness, not all th
307 installer->set_is_gallery_install(from_webstore); 311 installer->set_is_gallery_install(from_webstore);
308 312
309 content::NotificationRegistrar registrar; 313 content::NotificationRegistrar registrar;
310 registrar.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, 314 registrar.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE,
311 content::Source<CrxInstaller>(installer.get())); 315 content::Source<CrxInstaller>(installer.get()));
312 316
313 installer->InstallCrx(crx_path); 317 installer->InstallCrx(crx_path);
314 318
315 ui_test_utils::RunMessageLoop(); 319 ui_test_utils::RunMessageLoop();
316 } 320 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 case content::NOTIFICATION_LOAD_STOP: 592 case content::NOTIFICATION_LOAD_STOP:
589 VLOG(1) << "Got LOAD_STOP notification."; 593 VLOG(1) << "Got LOAD_STOP notification.";
590 MessageLoopForUI::current()->Quit(); 594 MessageLoopForUI::current()->Quit();
591 break; 595 break;
592 596
593 default: 597 default:
594 NOTREACHED(); 598 NOTREACHED();
595 break; 599 break;
596 } 600 }
597 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698