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

Side by Side Diff: chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos_unittest.cc

Issue 2830903003: PS - Scrub URL down to origin in Public Sessions (Closed)
Patch Set: Rebase Created 3 years, 8 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
(Empty)
1 // Copyright 2017 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 "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeo s.h"
6
7 #include <string>
8
9 #include "chromeos/login/login_state.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace extensions {
13
14 namespace {
15
16 const char kTestUrl[] = "http://www.foo.bar/baz?key=val";
17 const char kFilteredUrl[] = "http://www.foo.bar/";
18
19 } // namespace
20
21 class ExtensionTabUtilDelegateChromeOSTest : public testing::Test {
22 protected:
23 void SetUp() override;
24
25 ExtensionTabUtilDelegateChromeOS delegate_;
26 api::tabs::Tab tab_;
27 };
28
29 void ExtensionTabUtilDelegateChromeOSTest::SetUp() {
30 tab_.url.reset(new std::string(kTestUrl));
31 }
32
33 TEST_F(ExtensionTabUtilDelegateChromeOSTest, NoFilteringOutsidePublicSession) {
34 ASSERT_FALSE(chromeos::LoginState::IsInitialized());
35
36 delegate_.ScrubTabForExtension(nullptr, nullptr, &tab_);
37 EXPECT_EQ(kTestUrl, *tab_.url);
38 }
39
40 TEST_F(ExtensionTabUtilDelegateChromeOSTest, ScrubURL) {
41 // Set Public Session state.
42 chromeos::LoginState::Initialize();
43 chromeos::LoginState::Get()->SetLoggedInState(
44 chromeos::LoginState::LOGGED_IN_ACTIVE,
45 chromeos::LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT);
46
47 delegate_.ScrubTabForExtension(nullptr, nullptr, &tab_);
48 EXPECT_EQ(kFilteredUrl, *tab_.url);
49
50 // Reset state at the end of test.
51 chromeos::LoginState::Shutdown();
52 }
53
54 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698