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

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

Issue 294903005: Add browser test for timezone resolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/wizard_controller.cc
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 782236cc53f948940b254edd9723f03e85269532..c0eb3289d1eab7ea30ef8b4ed5a5b1468d469688 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -12,6 +12,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_registry_simple.h"
@@ -154,6 +155,7 @@ WizardController::WizardController(chromeos::LoginDisplayHost* host,
skip_update_enroll_after_eula_(false),
login_screen_started_(false),
user_image_screen_return_to_previous_hack_(false),
+ timezone_resolved_(false),
weak_factory_(this) {
DCHECK(default_controller_ == NULL);
default_controller_ = this;
@@ -1000,6 +1002,10 @@ void WizardController::OnTimezoneResolved(
// (timezone_provider_) in this case. Expect crash here.
DCHECK(timezone_provider_.get());
+ timezone_resolved_ = true;
+ base::ScopedClosureRunner inform_test(on_timezone_resolved_for_testing_);
+ on_timezone_resolved_for_testing_.Reset();
+
VLOG(1) << "Resolved local timezone={" << timezone->ToStringForDebug()
<< "}.";
@@ -1066,4 +1072,13 @@ void WizardController::OnLocationResolved(const Geoposition& position,
base::Unretained(this)));
}
+bool WizardController::SetOnTimeZoneResolvedForTesting(
+ const base::Closure& callback) {
+ if (timezone_resolved_)
+ return false;
+
+ on_timezone_resolved_for_testing_ = callback;
+ return true;
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | chrome/browser/chromeos/login/wizard_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698