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

Side by Side Diff: sync/util/get_session_name_unittest.cc

Issue 14113050: sync: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/tools/testserver/run_sync_testserver.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "sync/util/get_session_name.h" 9 #include "sync/util/get_session_name.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 #if defined(OS_CHROMEOS) 12 #if defined(OS_CHROMEOS)
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "chromeos/chromeos_switches.h" 14 #include "chromeos/chromeos_switches.h"
15 #endif // OS_CHROMEOS 15 #endif // OS_CHROMEOS
16 16
17 namespace syncer { 17 namespace syncer {
18 18
19 namespace { 19 namespace {
20 20
21 class GetSessionNameTest : public ::testing::Test { 21 class GetSessionNameTest : public ::testing::Test {
22 public: 22 public:
23 void SetSessionNameAndQuit(const std::string& session_name) { 23 void SetSessionNameAndQuit(const std::string& session_name) {
24 session_name_ = session_name; 24 session_name_ = session_name;
25 message_loop_.Quit(); 25 message_loop_.Quit();
26 } 26 }
27 27
28 protected: 28 protected:
29 MessageLoop message_loop_; 29 base::MessageLoop message_loop_;
30 std::string session_name_; 30 std::string session_name_;
31 }; 31 };
32 32
33 // Call GetSessionNameSynchronouslyForTesting and make sure its return 33 // Call GetSessionNameSynchronouslyForTesting and make sure its return
34 // value looks sane. 34 // value looks sane.
35 TEST_F(GetSessionNameTest, GetSessionNameSynchronously) { 35 TEST_F(GetSessionNameTest, GetSessionNameSynchronously) {
36 const std::string& session_name = GetSessionNameSynchronouslyForTesting(); 36 const std::string& session_name = GetSessionNameSynchronouslyForTesting();
37 EXPECT_FALSE(session_name.empty()); 37 EXPECT_FALSE(session_name.empty());
38 } 38 }
39 39
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 GetSessionName(message_loop_.message_loop_proxy(), 80 GetSessionName(message_loop_.message_loop_proxy(),
81 base::Bind(&GetSessionNameTest::SetSessionNameAndQuit, 81 base::Bind(&GetSessionNameTest::SetSessionNameAndQuit,
82 base::Unretained(this))); 82 base::Unretained(this)));
83 message_loop_.Run(); 83 message_loop_.Run();
84 EXPECT_EQ(session_name_, GetSessionNameSynchronouslyForTesting()); 84 EXPECT_EQ(session_name_, GetSessionNameSynchronouslyForTesting());
85 } 85 }
86 86
87 } // namespace 87 } // namespace
88 88
89 } // namespace syncer 89 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/tools/testserver/run_sync_testserver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698