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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_unittest.cc

Issue 2849603003: Use ScopedTaskEnvironment instead of MessageLoopForUI in ui tests. (Closed)
Patch Set: CR-add-newline-after-include Created 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <memory> 5 #include <memory>
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/pickle.h" 8 #include "base/pickle.h"
10 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/scoped_task_environment.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "net/base/filename_util.h" 12 #include "net/base/filename_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "testing/platform_test.h" 14 #include "testing/platform_test.h"
15 #include "ui/base/dragdrop/os_exchange_data.h" 15 #include "ui/base/dragdrop/os_exchange_data.h"
16 #include "ui/events/platform/platform_event_source.h" 16 #include "ui/events/platform/platform_event_source.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace ui { 19 namespace ui {
20 20
21 class OSExchangeDataTest : public PlatformTest { 21 class OSExchangeDataTest : public PlatformTest {
22 public: 22 public:
23 OSExchangeDataTest() 23 OSExchangeDataTest()
24 : event_source_(ui::PlatformEventSource::CreateDefault()) {} 24 : scoped_task_environment_(
25 base::test::ScopedTaskEnvironment::MainThreadType::UI),
26 event_source_(ui::PlatformEventSource::CreateDefault()) {}
25 27
26 private: 28 private:
27 base::MessageLoopForUI message_loop_; 29 base::test::ScopedTaskEnvironment scoped_task_environment_;
28 std::unique_ptr<PlatformEventSource> event_source_; 30 std::unique_ptr<PlatformEventSource> event_source_;
29 }; 31 };
30 32
31 TEST_F(OSExchangeDataTest, StringDataGetAndSet) { 33 TEST_F(OSExchangeDataTest, StringDataGetAndSet) {
32 OSExchangeData data; 34 OSExchangeData data;
33 base::string16 input = base::ASCIIToUTF16("I can has cheezburger?"); 35 base::string16 input = base::ASCIIToUTF16("I can has cheezburger?");
34 EXPECT_FALSE(data.HasString()); 36 EXPECT_FALSE(data.HasString());
35 data.SetString(input); 37 data.SetString(input);
36 EXPECT_TRUE(data.HasString()); 38 EXPECT_TRUE(data.HasString());
37 39
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 176
175 OSExchangeData copy( 177 OSExchangeData copy(
176 std::unique_ptr<OSExchangeData::Provider>(data.provider().Clone())); 178 std::unique_ptr<OSExchangeData::Provider>(data.provider().Clone()));
177 base::string16 read_html; 179 base::string16 read_html;
178 EXPECT_TRUE(copy.GetHtml(&read_html, &url)); 180 EXPECT_TRUE(copy.GetHtml(&read_html, &url));
179 EXPECT_EQ(html, read_html); 181 EXPECT_EQ(html, read_html);
180 } 182 }
181 #endif 183 #endif
182 184
183 } // namespace ui 185 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698