Switch PPAPITests to run in browser_tests instead of ui_tests. The former is sharded and so tests run in parallel. Before this they were taking 17 minutes on the trybot. Now they take about a minute.

Another benefit is we can replace the sleeps with messages, so hopefully this makes the test faster/less flakier.

BUG=115595
Review URL: https://chromiumcodereview.appspot.com/9646027

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126019 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 7fc33a1..f9bc4494 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -288,16 +288,6 @@
 ChromeContentBrowserClient::ChromeContentBrowserClient() {
   for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i)
     allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]);
-
-  const CommandLine& command_line = *CommandLine::ForCurrentProcess();
-  std::string allowed_list =
-      command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
-  if (!allowed_list.empty()) {
-    StringTokenizer t(allowed_list, ",");
-    while (t.GetNext()) {
-      allowed_socket_origins_.insert(t.token());
-    }
-  }
 }
 
 ChromeContentBrowserClient::~ChromeContentBrowserClient() {
@@ -1532,6 +1522,19 @@
   if (allowed_socket_origins_.count(host))
     return true;
 
+  // Need to check this now and not on construction because otherwise it won't
+  // work with browser_tests.
+  const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+  std::string allowed_list =
+      command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
+  if (!allowed_list.empty()) {
+    StringTokenizer t(allowed_list, ",");
+    while (t.GetNext()) {
+      if (t.token() == host)
+        return true;
+    }
+  }
+
   Profile* profile = Profile::FromBrowserContext(browser_context);
   if (!profile || !profile->GetExtensionService())
     return false;