| OLD | NEW |
| 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 "chrome/browser/web_resource/eula_accepted_notifier.h" | 5 #include "chrome/browser/web_resource/eula_accepted_notifier.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/testing_pref_service.h" |
| 8 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 9 #include "chrome/test/base/scoped_testing_local_state.h" | |
| 10 #include "chrome/test/base/testing_browser_process.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 class EulaAcceptedNotifierTest : public testing::Test, | 12 class EulaAcceptedNotifierTest : public testing::Test, |
| 14 public EulaAcceptedNotifier::Observer { | 13 public EulaAcceptedNotifier::Observer { |
| 15 public: | 14 public: |
| 16 EulaAcceptedNotifierTest() : eula_accepted_called_(false) { | 15 EulaAcceptedNotifierTest() : eula_accepted_called_(false) { |
| 17 } | 16 } |
| 18 | 17 |
| 19 // testing::Test overrides. | 18 // testing::Test overrides. |
| 20 void SetUp() override { | 19 void SetUp() override { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 66 } |
| 68 | 67 |
| 69 TEST_F(EulaAcceptedNotifierTest, EulaNotInitiallyAccepted) { | 68 TEST_F(EulaAcceptedNotifierTest, EulaNotInitiallyAccepted) { |
| 70 EXPECT_FALSE(notifier()->IsEulaAccepted()); | 69 EXPECT_FALSE(notifier()->IsEulaAccepted()); |
| 71 SetEulaAcceptedPref(); | 70 SetEulaAcceptedPref(); |
| 72 EXPECT_TRUE(notifier()->IsEulaAccepted()); | 71 EXPECT_TRUE(notifier()->IsEulaAccepted()); |
| 73 EXPECT_TRUE(eula_accepted_called()); | 72 EXPECT_TRUE(eula_accepted_called()); |
| 74 // Call it a second time, to ensure the answer doesn't change. | 73 // Call it a second time, to ensure the answer doesn't change. |
| 75 EXPECT_TRUE(notifier()->IsEulaAccepted()); | 74 EXPECT_TRUE(notifier()->IsEulaAccepted()); |
| 76 } | 75 } |
| OLD | NEW |