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

Side by Side Diff: blimp/engine/app/settings_manager_unittest.cc

Issue 2629743003: Remove all blimp engine code (Closed)
Patch Set: Use consistent comment style in //chrome Created 3 years, 11 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
« no previous file with comments | « blimp/engine/app/settings_manager.cc ('k') | blimp/engine/app/switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "blimp/engine/app/settings_manager.h"
6
7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace blimp {
11 namespace engine {
12
13 namespace {
14
15 class MockSettingsManagerObserver : public SettingsManager::Observer {
16 public:
17 MOCK_METHOD0(OnWebPreferencesChanged, void());
18 };
19
20 class SettingsManagerTest : public testing::Test {
21 public:
22 SettingsManagerTest() {}
23
24 void SetUp() override { settings_manager_.AddObserver(&observer_); }
25
26 void TearDown() override { settings_manager_.RemoveObserver(&observer_); }
27
28 protected:
29 SettingsManager settings_manager_;
30 MockSettingsManagerObserver observer_;
31 };
32
33 TEST_F(SettingsManagerTest, InformsObserversCorrectly) {
34 EngineSettings settings = settings_manager_.GetEngineSettings();
35 EXPECT_FALSE(settings.record_whole_document);
36
37 EXPECT_CALL(observer_, OnWebPreferencesChanged()).Times(1);
38
39 settings.record_whole_document = true;
40 settings_manager_.UpdateEngineSettings(settings);
41 }
42
43 TEST_F(SettingsManagerTest, UpdatesSettingsCorrectly) {
44 EngineSettings settings = settings_manager_.GetEngineSettings();
45 EXPECT_FALSE(settings.record_whole_document);
46 EXPECT_EQ(settings.animation_policy,
47 content::ImageAnimationPolicy::IMAGE_ANIMATION_POLICY_NO_ANIMATION);
48
49 settings.record_whole_document = true;
50 settings.animation_policy =
51 content::ImageAnimationPolicy::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE;
52 settings_manager_.UpdateEngineSettings(settings);
53
54 content::WebPreferences prefs;
55 settings_manager_.UpdateWebkitPreferences(&prefs);
56 EXPECT_TRUE(prefs.record_whole_document);
57 EXPECT_EQ(
58 prefs.animation_policy,
59 content::ImageAnimationPolicy::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE);
60 EXPECT_TRUE(prefs.viewport_meta_enabled);
61 EXPECT_EQ(prefs.default_minimum_page_scale_factor, 0.25f);
62 EXPECT_EQ(prefs.default_maximum_page_scale_factor, 5.f);
63 EXPECT_TRUE(prefs.shrinks_viewport_contents_to_fit);
64 }
65
66 } // namespace
67
68 } // namespace engine
69 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/engine/app/settings_manager.cc ('k') | blimp/engine/app/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698