Loosen up heuristics for detecting account creation forms.
[chromium-blink-merge.git] / sync / util / get_session_name_unittest.cc
blobb4922f6585a8e993caa561957896aaff487e497c
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
3 // found in the LICENSE file.
5 #include <string>
7 #include "base/bind.h"
8 #include "base/message_loop.h"
9 #include "sync/util/get_session_name.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace syncer {
14 namespace {
16 class GetSessionNameTest : public ::testing::Test {
17 public:
18 void SetSessionNameAndQuit(const std::string& session_name) {
19 session_name_ = session_name;
20 message_loop_.Quit();
23 protected:
24 MessageLoop message_loop_;
25 std::string session_name_;
28 // Call GetSessionNameSynchronouslyForTesting and make sure its return
29 // value looks sane.
30 TEST_F(GetSessionNameTest, GetSessionNameSynchronously) {
31 const std::string& session_name = GetSessionNameSynchronouslyForTesting();
32 EXPECT_FALSE(session_name.empty());
35 // Calls GetSessionName and runs the message loop until it comes back
36 // with a session name. Makes sure the returned session name is equal
37 // to the return value of GetSessionNameSynchronouslyForTesting().
38 TEST_F(GetSessionNameTest, GetSessionName) {
39 GetSessionName(message_loop_.message_loop_proxy(),
40 base::Bind(&GetSessionNameTest::SetSessionNameAndQuit,
41 base::Unretained(this)));
42 message_loop_.Run();
43 EXPECT_EQ(session_name_, GetSessionNameSynchronouslyForTesting());
46 } // namespace
48 } // namespace syncer