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

Unified Diff: chrome/browser/chromeos/login/login_utils_browsertest.cc

Issue 11506006: [cros] RLZ tracking can be turned off via a flag file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set zero delay for RLZTracker in browser_tests Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/login_utils_browsertest.cc
diff --git a/chrome/browser/chromeos/login/login_utils_browsertest.cc b/chrome/browser/chromeos/login/login_utils_browsertest.cc
index ab90a32f1725503624e06f832e8454337ee39e56..76b60783fba35d1fff4204d5a92632a9be32ef5f 100644
--- a/chrome/browser/chromeos/login/login_utils_browsertest.cc
+++ b/chrome/browser/chromeos/login/login_utils_browsertest.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/rlz/rlz.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -50,6 +51,10 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(ENABLE_RLZ)
+#include "rlz/lib/rlz_value_store.h"
+#endif
+
namespace chromeos {
namespace {
@@ -264,6 +269,11 @@ class LoginUtilsTest : public testing::Test,
NULL, NULL));
browser_process_->SetIOThread(io_thread_state_.get());
+#if defined(ENABLE_RLZ)
+ rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path());
+ RLZTracker::EnableZeroDelayForTesting();
+#endif
+
RunUntilIdle();
}
@@ -276,6 +286,9 @@ class LoginUtilsTest : public testing::Test,
InvokeOnIO(
base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this)));
+ // LoginUtils instance must not outlive Profile instances.
+ LoginUtils::Set(NULL);
+
// These trigger some tasks that have to run while BrowserThread::UI
// exists. Delete all the profiles before deleting the connector.
browser_process_->SetProfileManager(NULL);
@@ -511,6 +524,23 @@ TEST_F(LoginUtilsTest, EnterpriseLoginDoesntBlockForNormalUser) {
EXPECT_EQ(kUsernameOtherDomain, user_manager->GetLoggedInUser()->email());
}
+TEST_F(LoginUtilsTest, RlzInitialized) {
+ // No RLZ brand code set initially.
+ EXPECT_FALSE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand));
+
+ PrepareProfile(kUsername);
+
+ // RLZ brand code has been set to empty string.
+ EXPECT_TRUE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand));
+ EXPECT_EQ(std::string(), local_state_.Get()->GetString(prefs::kRLZBrand));
+
+ // RLZ value for homepage access point should have been initialized.
Roger Tawa OOO till Jul 10th 2012/12/14 15:27:07 I'm not sure I understand this comment. What are
Ivan Korotkov 2012/12/14 15:32:44 More likely that Init() has been called (otherwise
+ string16 rlz_string;
+ EXPECT_TRUE(RLZTracker::GetAccessPointRlz(
+ RLZTracker::CHROME_HOME_PAGE, &rlz_string));
+ EXPECT_EQ(string16(), rlz_string);
+}
+
TEST_P(LoginUtilsBlockingLoginTest, EnterpriseLoginBlocksForEnterpriseUser) {
UserManager* user_manager = UserManager::Get();
ASSERT_TRUE(!user_manager->IsUserLoggedIn());

Powered by Google App Engine
This is Rietveld 408576698