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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 13 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
14 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" | 14 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
15 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 15 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
16 #include "chrome/browser/chromeos/login/wizard_controller.h" | 16 #include "chrome/browser/chromeos/login/wizard_controller.h" |
17 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 17 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
22 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
24 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
25 #include "google_apis/gaia/fake_gaia.h" | 25 #include "google_apis/gaia/fake_gaia.h" |
26 #include "google_apis/gaia/gaia_switches.h" | 26 #include "google_apis/gaia/gaia_switches.h" |
27 #include "google_apis/gaia/gaia_urls.h" | 27 #include "google_apis/gaia/gaia_urls.h" |
28 #include "net/test/embedded_test_server/embedded_test_server.h" | 28 #include "net/test/embedded_test_server/embedded_test_server.h" |
29 #include "net/test/embedded_test_server/http_response.h" | 29 #include "net/test/embedded_test_server/http_response.h" |
| 30 #include "rlz/features/features.h" |
30 | 31 |
31 #if defined(ENABLE_RLZ) | 32 #if BUILDFLAG(ENABLE_RLZ) |
32 #include "components/rlz/rlz_tracker.h" | 33 #include "components/rlz/rlz_tracker.h" |
33 #endif | 34 #endif |
34 | 35 |
35 namespace chromeos { | 36 namespace chromeos { |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
39 #if defined(ENABLE_RLZ) | 40 #if BUILDFLAG(ENABLE_RLZ) |
40 void GetAccessPointRlzInBackgroundThread(rlz_lib::AccessPoint point, | 41 void GetAccessPointRlzInBackgroundThread(rlz_lib::AccessPoint point, |
41 base::string16* rlz) { | 42 base::string16* rlz) { |
42 ASSERT_FALSE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 43 ASSERT_FALSE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
43 ASSERT_TRUE(rlz::RLZTracker::GetAccessPointRlz(point, rlz)); | 44 ASSERT_TRUE(rlz::RLZTracker::GetAccessPointRlz(point, rlz)); |
44 } | 45 } |
45 #endif | 46 #endif |
46 | 47 |
47 } // namespace | 48 } // namespace |
48 | 49 |
49 class LoginUtilsTest : public OobeBaseTest { | 50 class LoginUtilsTest : public OobeBaseTest { |
(...skipping 24 matching lines...) Expand all Loading... |
74 | 75 |
75 // Wait for the session to start after submitting the credentials. This | 76 // Wait for the session to start after submitting the credentials. This |
76 // will wait until all the background requests are done. | 77 // will wait until all the background requests are done. |
77 session_started_observer.Wait(); | 78 session_started_observer.Wait(); |
78 } | 79 } |
79 | 80 |
80 private: | 81 private: |
81 DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest); | 82 DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest); |
82 }; | 83 }; |
83 | 84 |
84 #if defined(ENABLE_RLZ) | 85 #if BUILDFLAG(ENABLE_RLZ) |
85 IN_PROC_BROWSER_TEST_F(LoginUtilsTest, RlzInitialized) { | 86 IN_PROC_BROWSER_TEST_F(LoginUtilsTest, RlzInitialized) { |
86 WaitForSigninScreen(); | 87 WaitForSigninScreen(); |
87 | 88 |
88 // No RLZ brand code set initially. | 89 // No RLZ brand code set initially. |
89 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kRLZBrand)); | 90 EXPECT_FALSE(local_state()->HasPrefPath(prefs::kRLZBrand)); |
90 | 91 |
91 // Wait for blocking RLZ tasks to complete. | 92 // Wait for blocking RLZ tasks to complete. |
92 { | 93 { |
93 base::RunLoop loop; | 94 base::RunLoop loop; |
94 PrefChangeRegistrar registrar; | 95 PrefChangeRegistrar registrar; |
(...skipping 16 matching lines...) Expand all Loading... |
111 FROM_HERE, base::Bind(&GetAccessPointRlzInBackgroundThread, | 112 FROM_HERE, base::Bind(&GetAccessPointRlzInBackgroundThread, |
112 rlz::RLZTracker::ChromeHomePage(), &rlz_string), | 113 rlz::RLZTracker::ChromeHomePage(), &rlz_string), |
113 loop.QuitClosure()); | 114 loop.QuitClosure()); |
114 loop.Run(); | 115 loop.Run(); |
115 EXPECT_EQ(base::string16(), rlz_string); | 116 EXPECT_EQ(base::string16(), rlz_string); |
116 } | 117 } |
117 } | 118 } |
118 #endif | 119 #endif |
119 | 120 |
120 } // namespace chromeos | 121 } // namespace chromeos |
OLD | NEW |