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

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

Issue 11645040: RLZ on ChromeOS-related polishing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix RlzInitialized being hung Created 7 years, 12 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 | Annotate | Revision Log
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 "chrome/browser/chromeos/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 new ProfileManagerWithoutInit(scoped_temp_dir_.path())); 267 new ProfileManagerWithoutInit(scoped_temp_dir_.path()));
268 connector_ = browser_process_->browser_policy_connector(); 268 connector_ = browser_process_->browser_policy_connector();
269 connector_->Init(); 269 connector_->Init();
270 270
271 io_thread_state_.reset(new IOThread(local_state_.Get(), 271 io_thread_state_.reset(new IOThread(local_state_.Get(),
272 g_browser_process->policy_service(), 272 g_browser_process->policy_service(),
273 NULL, NULL)); 273 NULL, NULL));
274 browser_process_->SetIOThread(io_thread_state_.get()); 274 browser_process_->SetIOThread(io_thread_state_.get());
275 275
276 #if defined(ENABLE_RLZ) 276 #if defined(ENABLE_RLZ)
277 rlz_initialized_cb_ = base::Bind(&base::DoNothing);
277 rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path()); 278 rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path());
278 RLZTracker::EnableZeroDelayForTesting(); 279 RLZTracker::EnableZeroDelayForTesting();
279 #endif 280 #endif
280 281
281 RunUntilIdle(); 282 RunUntilIdle();
282 } 283 }
283 284
284 virtual void TearDown() OVERRIDE { 285 virtual void TearDown() OVERRIDE {
285 cryptohome::AsyncMethodCaller::Shutdown(); 286 cryptohome::AsyncMethodCaller::Shutdown();
286 mock_async_method_caller_ = NULL; 287 mock_async_method_caller_ = NULL;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 #if defined(ENABLE_RLZ) 556 #if defined(ENABLE_RLZ)
556 TEST_F(LoginUtilsTest, RlzInitialized) { 557 TEST_F(LoginUtilsTest, RlzInitialized) {
557 // No RLZ brand code set initially. 558 // No RLZ brand code set initially.
558 EXPECT_FALSE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand)); 559 EXPECT_FALSE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand));
559 560
560 base::RunLoop wait_for_rlz_init; 561 base::RunLoop wait_for_rlz_init;
561 rlz_initialized_cb_ = wait_for_rlz_init.QuitClosure(); 562 rlz_initialized_cb_ = wait_for_rlz_init.QuitClosure();
562 563
563 PrepareProfile(kUsername); 564 PrepareProfile(kUsername);
564 565
565 wait_for_rlz_init.Run();
566 // Wait for blocking RLZ tasks to complete.
567 RunUntilIdle();
568
569 // This should shortcut cookie transfer step that is missing due to 566 // This should shortcut cookie transfer step that is missing due to
570 // IO thread being mocked. 567 // IO thread being mocked.
571 EXPECT_TRUE(created_profile_); 568 EXPECT_TRUE(created_profile_);
572 LoginUtils::Get()->CompleteProfileCreate(created_profile_); 569 LoginUtils::Get()->CompleteProfileCreate(created_profile_);
573 570
571 wait_for_rlz_init.Run();
572 // Wait for blocking RLZ tasks to complete.
573 RunUntilIdle();
574
574 // RLZ brand code has been set to empty string. 575 // RLZ brand code has been set to empty string.
575 EXPECT_TRUE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand)); 576 EXPECT_TRUE(local_state_.Get()->HasPrefPath(prefs::kRLZBrand));
576 EXPECT_EQ(std::string(), local_state_.Get()->GetString(prefs::kRLZBrand)); 577 EXPECT_EQ(std::string(), local_state_.Get()->GetString(prefs::kRLZBrand));
577 578
578 // RLZ value for homepage access point should have been initialized. 579 // RLZ value for homepage access point should have been initialized.
579 string16 rlz_string; 580 string16 rlz_string;
580 EXPECT_TRUE(RLZTracker::GetAccessPointRlz( 581 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(
581 RLZTracker::CHROME_HOME_PAGE, &rlz_string)); 582 RLZTracker::CHROME_HOME_PAGE, &rlz_string));
582 EXPECT_EQ(string16(), rlz_string); 583 EXPECT_EQ(string16(), rlz_string);
583 } 584 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 681 }
681 682
682 INSTANTIATE_TEST_CASE_P( 683 INSTANTIATE_TEST_CASE_P(
683 LoginUtilsBlockingLoginTestInstance, 684 LoginUtilsBlockingLoginTestInstance,
684 LoginUtilsBlockingLoginTest, 685 LoginUtilsBlockingLoginTest,
685 testing::Values(0, 1, 2, 3, 4, 5)); 686 testing::Values(0, 1, 2, 3, 4, 5));
686 687
687 } // namespace 688 } // namespace
688 689
689 } 690 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/mock_login_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698