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

Side by Side Diff: chrome/browser/policy/user_policy_cache_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/policy/user_policy_cache.h" 5 #include "chrome/browser/policy/user_policy_cache.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/scoped_temp_dir.h"
11 #include "base/message_loop.h" 12 #include "base/message_loop.h"
12 #include "base/scoped_temp_dir.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" 14 #include "chrome/browser/policy/proto/cloud_policy.pb.h"
15 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 15 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
16 #include "chrome/browser/policy/proto/device_management_local.pb.h" 16 #include "chrome/browser/policy/proto/device_management_local.pb.h"
17 #include "chrome/browser/policy/proto/old_generic_format.pb.h" 17 #include "chrome/browser/policy/proto/old_generic_format.pb.h"
18 #include "content/public/test/test_browser_thread.h" 18 #include "content/public/test/test_browser_thread.h"
19 #include "policy/policy_constants.h" 19 #include "policy/policy_constants.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 FilePath test_file() { 123 FilePath test_file() {
124 return temp_dir_.path().AppendASCII("UserPolicyCacheTest"); 124 return temp_dir_.path().AppendASCII("UserPolicyCacheTest");
125 } 125 }
126 126
127 MessageLoop loop_; 127 MessageLoop loop_;
128 MockCloudPolicyCacheBaseObserver observer_; 128 MockCloudPolicyCacheBaseObserver observer_;
129 129
130 private: 130 private:
131 ScopedTempDir temp_dir_; 131 base::ScopedTempDir temp_dir_;
132 content::TestBrowserThread ui_thread_; 132 content::TestBrowserThread ui_thread_;
133 content::TestBrowserThread file_thread_; 133 content::TestBrowserThread file_thread_;
134 }; 134 };
135 135
136 TEST_F(UserPolicyCacheTest, DecodePolicy) { 136 TEST_F(UserPolicyCacheTest, DecodePolicy) {
137 em::CloudPolicySettings settings; 137 em::CloudPolicySettings settings;
138 settings.mutable_homepagelocation()->set_homepagelocation("chromium.org"); 138 settings.mutable_homepagelocation()->set_homepagelocation("chromium.org");
139 settings.mutable_javascriptenabled()->set_javascriptenabled(true); 139 settings.mutable_javascriptenabled()->set_javascriptenabled(true);
140 settings.mutable_javascriptenabled()->mutable_policy_options()->set_mode( 140 settings.mutable_javascriptenabled()->mutable_policy_options()->set_mode(
141 em::PolicyOptions::MANDATORY); 141 em::PolicyOptions::MANDATORY);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 UserPolicyCache cache(test_file(), true /* wait_for_policy_fetch */); 444 UserPolicyCache cache(test_file(), true /* wait_for_policy_fetch */);
445 EXPECT_FALSE(cache.IsReady()); 445 EXPECT_FALSE(cache.IsReady());
446 cache.SetFetchingDone(); 446 cache.SetFetchingDone();
447 EXPECT_FALSE(cache.IsReady()); 447 EXPECT_FALSE(cache.IsReady());
448 cache.Load(); 448 cache.Load();
449 loop_.RunAllPending(); 449 loop_.RunAllPending();
450 EXPECT_TRUE(cache.IsReady()); 450 EXPECT_TRUE(cache.IsReady());
451 } 451 }
452 452
453 } // namespace policy 453 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_store_unittest.cc ('k') | chrome/browser/prefs/pref_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698