Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / ios / chrome / browser / geolocation / omnibox_geolocation_local_state_unittest.mm
blob57632494d7db80fdc52c0821397eb6cb347e9314
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
3 // found in the LICENSE file.
5 #include <string>
7 #include "base/mac/scoped_nsobject.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/testing_pref_service.h"
10 #include "ios/chrome/browser/geolocation/location_manager.h"
11 #include "ios/chrome/browser/geolocation/omnibox_geolocation_local_state.h"
12 #include "ios/chrome/test/testing_application_context.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "testing/gtest_mac.h"
15 #include "testing/platform_test.h"
17 namespace {
19 class OmniboxGeolocationLocalStateTest : public PlatformTest {
20  protected:
21   OmniboxGeolocationLocalStateTest() {
22     TestingApplicationContext::GetGlobal()->SetLocalState(&prefs_);
23     location_manager_.reset([[LocationManager alloc] init]);
24     local_state_.reset([[OmniboxGeolocationLocalState alloc]
25         initWithLocationManager:location_manager_]);
26     [OmniboxGeolocationLocalState registerLocalState:prefs_.registry()];
27   }
29   ~OmniboxGeolocationLocalStateTest() override {
30     TestingApplicationContext::GetGlobal()->SetLocalState(nullptr);
31   }
33   TestingPrefServiceSimple prefs_;
34   base::scoped_nsobject<LocationManager> location_manager_;
35   base::scoped_nsobject<OmniboxGeolocationLocalState> local_state_;
38 TEST_F(OmniboxGeolocationLocalStateTest, LastAuthorizationAlertVersion) {
39   EXPECT_TRUE([local_state_ lastAuthorizationAlertVersion].empty());
41   std::string expectedVersion("fakeVersion");
42   [local_state_ setLastAuthorizationAlertVersion:expectedVersion];
43   EXPECT_EQ(expectedVersion, [local_state_ lastAuthorizationAlertVersion]);
46 }  // namespace