OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 ASSERT_TRUE(RLZTracker::GetAccessPointRlz(point, rlz)); | 39 ASSERT_TRUE(RLZTracker::GetAccessPointRlz(point, rlz)); |
40 } | 40 } |
41 #endif | 41 #endif |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 class LoginUtilsTest : public InProcessBrowserTest { | 45 class LoginUtilsTest : public InProcessBrowserTest { |
46 public: | 46 public: |
47 LoginUtilsTest() {} | 47 LoginUtilsTest() {} |
48 | 48 |
49 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 49 virtual void SetUpCommandLine(CommandLine* command_line) override { |
50 // Initialize the test server early, so that we can use its base url for | 50 // Initialize the test server early, so that we can use its base url for |
51 // the command line flags. | 51 // the command line flags. |
52 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 52 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
53 | 53 |
54 // Use the login manager screens and the gaia auth extension. | 54 // Use the login manager screens and the gaia auth extension. |
55 command_line->AppendSwitch(switches::kLoginManager); | 55 command_line->AppendSwitch(switches::kLoginManager); |
56 command_line->AppendSwitch(switches::kForceLoginManagerInTests); | 56 command_line->AppendSwitch(switches::kForceLoginManagerInTests); |
57 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 57 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
58 command_line->AppendSwitchASCII(::switches::kAuthExtensionPath, | 58 command_line->AppendSwitchASCII(::switches::kAuthExtensionPath, |
59 "gaia_auth"); | 59 "gaia_auth"); |
60 | 60 |
61 // Redirect requests to gaia and the policy server to the test server. | 61 // Redirect requests to gaia and the policy server to the test server. |
62 command_line->AppendSwitchASCII(::switches::kGaiaUrl, | 62 command_line->AppendSwitchASCII(::switches::kGaiaUrl, |
63 embedded_test_server()->base_url().spec()); | 63 embedded_test_server()->base_url().spec()); |
64 command_line->AppendSwitchASCII(::switches::kLsoUrl, | 64 command_line->AppendSwitchASCII(::switches::kLsoUrl, |
65 embedded_test_server()->base_url().spec()); | 65 embedded_test_server()->base_url().spec()); |
66 } | 66 } |
67 | 67 |
68 virtual void SetUpOnMainThread() OVERRIDE { | 68 virtual void SetUpOnMainThread() override { |
69 fake_gaia_.Initialize(); | 69 fake_gaia_.Initialize(); |
70 embedded_test_server()->RegisterRequestHandler( | 70 embedded_test_server()->RegisterRequestHandler( |
71 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_))); | 71 base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_))); |
72 } | 72 } |
73 | 73 |
74 virtual void TearDownOnMainThread() OVERRIDE { | 74 virtual void TearDownOnMainThread() override { |
75 RunUntilIdle(); | 75 RunUntilIdle(); |
76 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 76 EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
77 } | 77 } |
78 | 78 |
79 void RunUntilIdle() { | 79 void RunUntilIdle() { |
80 base::RunLoop().RunUntilIdle(); | 80 base::RunLoop().RunUntilIdle(); |
81 } | 81 } |
82 | 82 |
83 PrefService* local_state() { | 83 PrefService* local_state() { |
84 return g_browser_process->local_state(); | 84 return g_browser_process->local_state(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 RLZTracker::ChromeHomePage(), | 150 RLZTracker::ChromeHomePage(), |
151 &rlz_string), | 151 &rlz_string), |
152 loop.QuitClosure()); | 152 loop.QuitClosure()); |
153 loop.Run(); | 153 loop.Run(); |
154 EXPECT_EQ(base::string16(), rlz_string); | 154 EXPECT_EQ(base::string16(), rlz_string); |
155 } | 155 } |
156 } | 156 } |
157 #endif | 157 #endif |
158 | 158 |
159 } // namespace chromeos | 159 } // namespace chromeos |
OLD | NEW |