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

Side by Side Diff: chrome/browser/chromeos/login/login_utils_browsertest.cc

Issue 1212163011: Componentize chrome/browser/rlz (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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) 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"
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/rlz/rlz.h"
18 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 17 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
19 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/in_process_browser_test.h" 20 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chromeos/chromeos_switches.h" 21 #include "chromeos/chromeos_switches.h"
23 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
24 #include "content/public/test/test_utils.h" 23 #include "content/public/test/test_utils.h"
25 #include "google_apis/gaia/fake_gaia.h" 24 #include "google_apis/gaia/fake_gaia.h"
26 #include "google_apis/gaia/gaia_switches.h" 25 #include "google_apis/gaia/gaia_switches.h"
27 #include "google_apis/gaia/gaia_urls.h" 26 #include "google_apis/gaia/gaia_urls.h"
28 #include "net/test/embedded_test_server/embedded_test_server.h" 27 #include "net/test/embedded_test_server/embedded_test_server.h"
29 #include "net/test/embedded_test_server/http_response.h" 28 #include "net/test/embedded_test_server/http_response.h"
30 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
31 30
31 #if defined(ENABLE_RLZ)
32 #include "components/rlz/rlz_tracker.h"
33 #endif
34
32 namespace chromeos { 35 namespace chromeos {
33 36
34 namespace { 37 namespace {
35 38
36 #if defined(ENABLE_RLZ) 39 #if defined(ENABLE_RLZ)
37 void GetAccessPointRlzInBackgroundThread(rlz_lib::AccessPoint point, 40 void GetAccessPointRlzInBackgroundThread(rlz_lib::AccessPoint point,
38 base::string16* rlz) { 41 base::string16* rlz) {
39 ASSERT_FALSE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 42 ASSERT_FALSE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
40 ASSERT_TRUE(RLZTracker::GetAccessPointRlz(point, rlz)); 43 ASSERT_TRUE(rlz::RLZTracker::GetAccessPointRlz(point, rlz));
41 } 44 }
42 #endif 45 #endif
43 46
44 } // namespace 47 } // namespace
45 48
46 class LoginUtilsTest : public OobeBaseTest, 49 class LoginUtilsTest : public OobeBaseTest,
47 public testing::WithParamInterface<bool> { 50 public testing::WithParamInterface<bool> {
48 public: 51 public:
49 LoginUtilsTest() { set_use_webview(GetParam()); } 52 LoginUtilsTest() { set_use_webview(GetParam()); }
50 53
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // RLZ brand code has been set to empty string. 102 // RLZ brand code has been set to empty string.
100 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kRLZBrand)); 103 EXPECT_TRUE(local_state()->HasPrefPath(prefs::kRLZBrand));
101 EXPECT_EQ(std::string(), local_state()->GetString(prefs::kRLZBrand)); 104 EXPECT_EQ(std::string(), local_state()->GetString(prefs::kRLZBrand));
102 105
103 // RLZ value for homepage access point should have been initialized. 106 // RLZ value for homepage access point should have been initialized.
104 // This value must be obtained in a background thread. 107 // This value must be obtained in a background thread.
105 { 108 {
106 base::RunLoop loop; 109 base::RunLoop loop;
107 base::string16 rlz_string; 110 base::string16 rlz_string;
108 content::BrowserThread::PostBlockingPoolTaskAndReply( 111 content::BrowserThread::PostBlockingPoolTaskAndReply(
109 FROM_HERE, 112 FROM_HERE, base::Bind(&GetAccessPointRlzInBackgroundThread,
110 base::Bind(&GetAccessPointRlzInBackgroundThread, 113 rlz::RLZTracker::ChromeHomePage(), &rlz_string),
111 RLZTracker::ChromeHomePage(),
112 &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 119
119 INSTANTIATE_TEST_CASE_P(LoginUtilsTestSuite, LoginUtilsTest, testing::Bool()); 120 INSTANTIATE_TEST_CASE_P(LoginUtilsTestSuite, LoginUtilsTest, testing::Bool());
120 121
121 #endif 122 #endif
122 123
123 } // namespace chromeos 124 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/login/session/user_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698