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

Side by Side Diff: chrome/browser/chrome_content_browser_client_browsertest.cc

Issue 977323003: Disable easter egg on enterprised enrolled devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add browser test for disable easter egg flag Created 5 years, 9 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 | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/common/chrome_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/tabs/tab_strip_model.h" 7 #include "chrome/browser/ui/tabs/tab_strip_model.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/navigation_controller.h" 11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 #if defined(OS_CHROMEOS)
18 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
20 #endif
21
17 namespace content { 22 namespace content {
18 23
19 class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest { 24 class ChromeContentBrowserClientBrowserTest : public InProcessBrowserTest {
20 public: 25 public:
21 // Returns the last committed navigation entry of the first tab. May be NULL 26 // Returns the last committed navigation entry of the first tab. May be NULL
22 // if there is no such entry. 27 // if there is no such entry.
23 NavigationEntry* GetLastCommittedEntry() { 28 NavigationEntry* GetLastCommittedEntry() {
24 return browser()->tab_strip_model()->GetWebContentsAt(0)-> 29 return browser()->tab_strip_model()->GetWebContentsAt(0)->
25 GetController().GetLastCommittedEntry(); 30 GetController().GetLastCommittedEntry();
26 } 31 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const GURL url(test_server()->GetURL("files/title1.html")); 98 const GURL url(test_server()->GetURL("files/title1.html"));
94 99
95 ui_test_utils::NavigateToURL(browser(), url); 100 ui_test_utils::NavigateToURL(browser(), url);
96 NavigationEntry* entry = GetLastCommittedEntry(); 101 NavigationEntry* entry = GetLastCommittedEntry();
97 102
98 ASSERT_TRUE(entry != NULL); 103 ASSERT_TRUE(entry != NULL);
99 EXPECT_EQ(url, entry->GetURL()); 104 EXPECT_EQ(url, entry->GetURL());
100 EXPECT_EQ(url, entry->GetVirtualURL()); 105 EXPECT_EQ(url, entry->GetVirtualURL());
101 } 106 }
102 107
108 #if defined(OS_CHROMEOS)
109 // Test that the disable Easter Egg switch is appended if Chrome OS and
110 // the device is enterprise enrolled.
111 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
112 ShouldDisableEasterEgg) {
113 const base::CommandLine& browser_command_line =
114 *base::CommandLine::ForCurrentProcess();
115
116 // policy::BrowserPolicyConnectorChromeOS* connector =
117 // g_browser_process->platform_part()->browser_policy_connector_chromeos() ;
118 // const bool is_enterprise_managed = connector->IsEnterpriseManaged();
edwardjung 2015/03/11 19:09:48 This doesn't compile as there is no reference to
Andrew T Wilson (Slow) 2015/03/12 15:44:38 Have you tried including browser_process.h? Take
119 const bool is_enterprise_managed = true;
120 if (is_enterprise_managed) {
121 EXPECT_TRUE(browser_command_line.HasSwitch(
122 switches::kDisableDinosaurEasterEgg));
123 } else {
124 EXPECT_FALSE(browser_command_line.HasSwitch(
125 switches::kDisableDinosaurEasterEgg));
126 }
127 }
128 #endif
129
103 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698