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

Side by Side Diff: chrome/browser/chromeos/policy/login_policy_test_base.h

Issue 1185593002: Move reusable part of LoginPolicyTestBase into a helper class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@key_perm
Patch Set: Addressed comments Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_POLICY_TEST_BASE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_POLICY_TEST_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_POLICY_TEST_BASE_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_POLICY_TEST_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/scoped_temp_dir.h"
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" 12 #include "chrome/browser/chromeos/login/test/oobe_base_test.h"
14 13
15 namespace base { 14 namespace base {
16 class FilePath;
17 class DictionaryValue; 15 class DictionaryValue;
18 } 16 }
19 17
20 namespace policy { 18 namespace policy {
21 19
22 class LocalPolicyTestServer; 20 class UserPolicyTestHelper;
23 21
24 // This class can be used to implement tests which need policy to be set prior 22 // This class can be used to implement tests which need policy to be set prior
25 // to login. 23 // to login.
26 class LoginPolicyTestBase : public chromeos::OobeBaseTest { 24 class LoginPolicyTestBase : public chromeos::OobeBaseTest {
27 protected: 25 protected:
28 LoginPolicyTestBase(); 26 LoginPolicyTestBase();
29 ~LoginPolicyTestBase() override; 27 ~LoginPolicyTestBase() override;
30 28
31 // chromeos::OobeBaseTest:: 29 // chromeos::OobeBaseTest::
32 void SetUp() override; 30 void SetUp() override;
33 void SetUpCommandLine(base::CommandLine* command_line) override; 31 void SetUpCommandLine(base::CommandLine* command_line) override;
34 void SetUpOnMainThread() override; 32 void SetUpOnMainThread() override;
35 33
36 virtual scoped_ptr<base::DictionaryValue> GetMandatoryPoliciesValue() const; 34 virtual void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const;
37 virtual scoped_ptr<base::DictionaryValue> GetRecommendedPoliciesValue() const; 35 virtual void GetRecommendedPoliciesValue(base::DictionaryValue* policy) const;
38 36
39 void SkipToLoginScreen(); 37 void SkipToLoginScreen();
40 void LogIn(const std::string& user_id, const std::string& password); 38 void LogIn(const std::string& user_id, const std::string& password);
41 39
42 static const char kAccountPassword[]; 40 static const char kAccountPassword[];
43 static const char kAccountId[]; 41 static const char kAccountId[];
44 42
45 private: 43 private:
46 void SetUpGaiaServerWithAccessTokens(); 44 void SetUpGaiaServerWithAccessTokens();
47 void SetMergeSessionParams(const std::string& email); 45 void SetMergeSessionParams();
48 void SetServerPolicy();
49 base::FilePath PolicyFilePath() const;
50 46
51 scoped_ptr<LocalPolicyTestServer> test_server_; 47 scoped_ptr<UserPolicyTestHelper> user_policy_helper_;
52 base::ScopedTempDir temp_dir_;
53 48
54 DISALLOW_COPY_AND_ASSIGN(LoginPolicyTestBase); 49 DISALLOW_COPY_AND_ASSIGN(LoginPolicyTestBase);
55 }; 50 };
56 51
57 } // namespace policy 52 } // namespace policy
58 53
59 #endif // CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_POLICY_TEST_BASE_H_ 54 #endif // CHROME_BROWSER_CHROMEOS_POLICY_LOGIN_POLICY_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698