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

Side by Side Diff: chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 6
7 #include "base/base64url.h" 7 #include "base/base64url.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/threading/thread_restrictions.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/extensions/extension_browsertest.h" 17 #include "chrome/browser/extensions/extension_browsertest.h"
17 #include "chrome/browser/policy/profile_policy_connector.h" 18 #include "chrome/browser/policy/profile_policy_connector.h"
18 #include "chrome/browser/policy/profile_policy_connector_factory.h" 19 #include "chrome/browser/policy/profile_policy_connector_factory.h"
19 #include "chrome/browser/policy/test/local_policy_test_server.h" 20 #include "chrome/browser/policy/test/local_policy_test_server.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "components/policy/core/browser/browser_policy_connector.h" 24 #include "components/policy/core/browser/browser_policy_connector.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 310
310 // Verify that the policy cache exists. 311 // Verify that the policy cache exists.
311 std::string cache_key; 312 std::string cache_key;
312 base::Base64UrlEncode( 313 base::Base64UrlEncode(
313 "extension-policy", base::Base64UrlEncodePolicy::INCLUDE_PADDING, 314 "extension-policy", base::Base64UrlEncodePolicy::INCLUDE_PADDING,
314 &cache_key); 315 &cache_key);
315 std::string cache_subkey; 316 std::string cache_subkey;
316 base::Base64UrlEncode( 317 base::Base64UrlEncode(
317 kTestExtension, base::Base64UrlEncodePolicy::INCLUDE_PADDING, 318 kTestExtension, base::Base64UrlEncodePolicy::INCLUDE_PADDING,
318 &cache_subkey); 319 &cache_subkey);
320 base::ThreadRestrictions::ScopedAllowIO allow_io;
319 base::FilePath cache_path = browser()->profile()->GetPath() 321 base::FilePath cache_path = browser()->profile()->GetPath()
320 .Append(FILE_PATH_LITERAL("Policy")) 322 .Append(FILE_PATH_LITERAL("Policy"))
321 .Append(FILE_PATH_LITERAL("Components")) 323 .Append(FILE_PATH_LITERAL("Components"))
322 .AppendASCII(cache_key) 324 .AppendASCII(cache_key)
323 .AppendASCII(cache_subkey); 325 .AppendASCII(cache_subkey);
324 EXPECT_TRUE(base::PathExists(cache_path)); 326 EXPECT_TRUE(base::PathExists(cache_path));
325 327
326 // Now sign-out. The policy cache should be removed, and the extension should 328 // Now sign-out. The policy cache should be removed, and the extension should
327 // get an empty policy update. 329 // get an empty policy update.
328 ExtensionTestMessageListener event_listener("event", true); 330 ExtensionTestMessageListener event_listener("event", true);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ExtensionTestMessageListener policy_listener1("{}", true); 404 ExtensionTestMessageListener policy_listener1("{}", true);
403 event_listener_->Reply("get-policy-Name"); 405 event_listener_->Reply("get-policy-Name");
404 EXPECT_TRUE(policy_listener1.WaitUntilSatisfied()); 406 EXPECT_TRUE(policy_listener1.WaitUntilSatisfied());
405 407
406 ExtensionTestMessageListener policy_listener2(kTestPolicy2JSON, false); 408 ExtensionTestMessageListener policy_listener2(kTestPolicy2JSON, false);
407 policy_listener1.Reply("get-policy-Another"); 409 policy_listener1.Reply("get-policy-Another");
408 EXPECT_TRUE(policy_listener2.WaitUntilSatisfied()); 410 EXPECT_TRUE(policy_listener2.WaitUntilSatisfied());
409 } 411 }
410 412
411 } // namespace policy 413 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_browsertest.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698