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

Side by Side Diff: blimp/client/core/blimp_client_context_impl_unittest.cc

Issue 2349073002: Blimp Settings framework on the c++ side (Closed)
Patch Set: Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/core/blimp_client_context_impl.h" 5 #include "blimp/client/core/blimp_client_context_impl.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "blimp/client/core/contents/blimp_contents_impl.h" 12 #include "blimp/client/core/contents/blimp_contents_impl.h"
13 #include "blimp/client/core/contents/tab_control_feature.h" 13 #include "blimp/client/core/contents/tab_control_feature.h"
14 #include "blimp/client/core/settings/settings.h"
14 #include "blimp/client/public/blimp_client_context_delegate.h" 15 #include "blimp/client/public/blimp_client_context_delegate.h"
15 #include "blimp/client/public/contents/blimp_contents.h" 16 #include "blimp/client/public/contents/blimp_contents.h"
16 #include "blimp/client/test/compositor/mock_compositor_dependencies.h" 17 #include "blimp/client/test/compositor/mock_compositor_dependencies.h"
17 #include "blimp/client/test/test_blimp_client_context_delegate.h" 18 #include "blimp/client/test/test_blimp_client_context_delegate.h"
19 #include "components/prefs/testing_pref_service.h"
18 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/gfx/native_widget_types.h" 22 #include "ui/gfx/native_widget_types.h"
21 23
22 #if defined(OS_ANDROID) 24 #if defined(OS_ANDROID)
23 #include "ui/android/window_android.h" 25 #include "ui/android/window_android.h"
24 #endif // defined(OS_ANDROID) 26 #endif // defined(OS_ANDROID)
25 27
26 namespace blimp { 28 namespace blimp {
27 namespace client { 29 namespace client {
(...skipping 26 matching lines...) Expand all
54 gfx::NativeWindow window_ = nullptr; 56 gfx::NativeWindow window_ = nullptr;
55 57
56 private: 58 private:
57 base::MessageLoop message_loop_; 59 base::MessageLoop message_loop_;
58 60
59 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImplTest); 61 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImplTest);
60 }; 62 };
61 63
62 TEST_F(BlimpClientContextImplTest, 64 TEST_F(BlimpClientContextImplTest,
63 CreatedBlimpContentsGetsHelpersAttachedAndHasTabControlFeature) { 65 CreatedBlimpContentsGetsHelpersAttachedAndHasTabControlFeature) {
66 TestingPrefServiceSimple prefs;
67 Settings::RegisterPrefs(prefs.registry());
68
64 BlimpClientContextImpl blimp_client_context( 69 BlimpClientContextImpl blimp_client_context(
65 io_thread_.task_runner(), io_thread_.task_runner(), 70 io_thread_.task_runner(), io_thread_.task_runner(),
66 base::MakeUnique<MockCompositorDependencies>()); 71 base::MakeUnique<MockCompositorDependencies>(), &prefs);
67 TestBlimpClientContextDelegate delegate; 72 TestBlimpClientContextDelegate delegate;
68 blimp_client_context.SetDelegate(&delegate); 73 blimp_client_context.SetDelegate(&delegate);
69 74
70 BlimpContents* attached_blimp_contents = nullptr; 75 BlimpContents* attached_blimp_contents = nullptr;
71 76
72 EXPECT_CALL(delegate, AttachBlimpContentsHelpers(testing::_)) 77 EXPECT_CALL(delegate, AttachBlimpContentsHelpers(testing::_))
73 .WillOnce(testing::SaveArg<0>(&attached_blimp_contents)) 78 .WillOnce(testing::SaveArg<0>(&attached_blimp_contents))
74 .RetiresOnSaturation(); 79 .RetiresOnSaturation();
75 80
76 std::unique_ptr<BlimpContents> blimp_contents = 81 std::unique_ptr<BlimpContents> blimp_contents =
77 blimp_client_context.CreateBlimpContents(window_); 82 blimp_client_context.CreateBlimpContents(window_);
78 DCHECK(blimp_contents); 83 DCHECK(blimp_contents);
79 DCHECK_EQ(blimp_contents.get(), attached_blimp_contents); 84 DCHECK_EQ(blimp_contents.get(), attached_blimp_contents);
80 } 85 }
81 86
82 } // namespace 87 } // namespace
83 } // namespace client 88 } // namespace client
84 } // namespace blimp 89 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698