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

Unified Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1369603003: Remove 2-stage RenderWidget initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_offscreen_contexts
Patch Set: fix racy test Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/apps/guest_view/web_view_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index 8c3491f1bcddb09c160d15a60ffb38d03a9544c5..e4931f8e99cf5f5fd2ed6c7c039b12070d64d510 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -2893,20 +2893,25 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, TaskManagementPreExistingWebViews) {
task_manager.StartObserving();
// The pre-existing tab and guest tasks are provided.
- // 4 tasks expected in the following order:
+ // 4 tasks expected. The order is arbitrary.
// Tab: about:blank,
// Background Page: <webview> task manager test,
// App: <webview> task manager test,
// Webview: WebViewed test content.
EXPECT_EQ(4U, task_manager.tasks().size());
- const task_management::Task* task = task_manager.tasks().back();
- EXPECT_EQ(task_management::Task::GUEST, task->GetType());
- const base::string16 title = task->title();
- const base::string16 expected_prefix = GetExpectedPrefix(guest_contents);
- EXPECT_TRUE(base::StartsWith(title,
- expected_prefix,
- base::CompareCase::INSENSITIVE_ASCII));
+ bool found = false;
+ for (auto* task: task_manager.tasks()) {
+ if (task->GetType() != task_management::Task::GUEST)
+ continue;
+ EXPECT_FALSE(found);
+ found = true;
+ const base::string16 title = task->title();
+ const base::string16 expected_prefix = GetExpectedPrefix(guest_contents);
+ EXPECT_TRUE(base::StartsWith(title, expected_prefix,
+ base::CompareCase::INSENSITIVE_ASCII));
+ }
+ EXPECT_TRUE(found);
}
// Tests that the post-existing WebViews are provided to the task manager.
@@ -2929,20 +2934,25 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, TaskManagementPostExistingWebViews) {
content::WebContents* guest_contents =
LoadGuest("/extensions/platform_apps/web_view/task_manager/guest.html",
"web_view/task_manager");
- // 4 tasks expected in the following order:
+ // 4 tasks expected. The order is arbitrary.
// Tab: about:blank,
// Background Page: <webview> task manager test,
// App: <webview> task manager test,
// Webview: WebViewed test content.
EXPECT_EQ(4U, task_manager.tasks().size());
- const task_management::Task* task = task_manager.tasks().back();
- EXPECT_EQ(task_management::Task::GUEST, task->GetType());
- const base::string16 title = task->title();
- const base::string16 expected_prefix = GetExpectedPrefix(guest_contents);
- EXPECT_TRUE(base::StartsWith(title,
- expected_prefix,
- base::CompareCase::INSENSITIVE_ASCII));
+ bool found = false;
Fady Samuel 2015/09/30 22:21:04 Could you please move this to a helper method? Has
piman 2015/09/30 22:36:16 Done.
+ for (auto* task: task_manager.tasks()) {
+ if (task->GetType() != task_management::Task::GUEST)
+ continue;
+ EXPECT_FALSE(found);
+ found = true;
+ const base::string16 title = task->title();
+ const base::string16 expected_prefix = GetExpectedPrefix(guest_contents);
+ EXPECT_TRUE(base::StartsWith(title, expected_prefix,
+ base::CompareCase::INSENSITIVE_ASCII));
+ }
+ EXPECT_TRUE(found);
}
#endif // defined(ENABLE_TASK_MANAGER)
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698