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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_browsertest.cc

Issue 1052683006: [cros] UserCloudPolicyManagerTest, ForceMaximizeOnFirstRunTest run for iframe/webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only tests Created 5 years, 7 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/chromeos/policy/force_maximize_on_first_run_chromeos_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string> 5 #include <string>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h" 10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h"
11 #include "chrome/browser/prefs/session_startup_pref.h" 11 #include "chrome/browser/prefs/session_startup_pref.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/host_desktop.h" 14 #include "chrome/browser/ui/host_desktop.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "policy/policy_constants.h" 16 #include "policy/policy_constants.h"
17 17
18 namespace policy { 18 namespace policy {
19 19
20 class UserCloudPolicyManagerTest : public LoginPolicyTestBase { 20 // Boolean parameter is used to run this test for webview (true) and for
21 // iframe (false) GAIA sign in.
22 class UserCloudPolicyManagerTest : public LoginPolicyTestBase,
23 public testing::WithParamInterface<bool> {
21 protected: 24 protected:
22 UserCloudPolicyManagerTest() : LoginPolicyTestBase() {} 25 UserCloudPolicyManagerTest() : LoginPolicyTestBase() {
26 set_use_webview(GetParam());
27 }
23 28
24 scoped_ptr<base::DictionaryValue> GetMandatoryPoliciesValue() const override { 29 scoped_ptr<base::DictionaryValue> GetMandatoryPoliciesValue() const override {
25 scoped_ptr<base::ListValue> list(new base::ListValue); 30 scoped_ptr<base::ListValue> list(new base::ListValue);
26 list->AppendString("chrome://policy"); 31 list->AppendString("chrome://policy");
27 list->AppendString("chrome://about"); 32 list->AppendString("chrome://about");
28 33
29 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 34 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
30 dict->Set(key::kRestoreOnStartupURLs, list.Pass()); 35 dict->Set(key::kRestoreOnStartupURLs, list.Pass());
31 dict->SetInteger(key::kRestoreOnStartup, 36 dict->SetInteger(key::kRestoreOnStartup,
32 SessionStartupPref::kPrefValueURLs); 37 SessionStartupPref::kPrefValueURLs);
33 38
34 return dict; 39 return dict;
35 } 40 }
36 41
37 private: 42 private:
38 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest); 43 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest);
39 }; 44 };
40 45
41 IN_PROC_BROWSER_TEST_F(UserCloudPolicyManagerTest, StartSession) { 46 IN_PROC_BROWSER_TEST_P(UserCloudPolicyManagerTest, StartSession) {
42 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"}; 47 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"};
43 48
44 SkipToLoginScreen(); 49 SkipToLoginScreen();
45 LogIn(kAccountId, kAccountPassword); 50 LogIn(kAccountId, kAccountPassword);
46 51
47 // Check that the startup pages specified in policy were opened. 52 // Check that the startup pages specified in policy were opened.
48 BrowserList* browser_list = 53 BrowserList* browser_list =
49 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); 54 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
50 EXPECT_EQ(1U, browser_list->size()); 55 EXPECT_EQ(1U, browser_list->size());
51 Browser* browser = browser_list->get(0); 56 Browser* browser = browser_list->get(0);
52 ASSERT_TRUE(browser); 57 ASSERT_TRUE(browser);
53 58
54 TabStripModel* tabs = browser->tab_strip_model(); 59 TabStripModel* tabs = browser->tab_strip_model();
55 ASSERT_TRUE(tabs); 60 ASSERT_TRUE(tabs);
56 const int expected_tab_count = static_cast<int>(arraysize(kStartupURLs)); 61 const int expected_tab_count = static_cast<int>(arraysize(kStartupURLs));
57 EXPECT_EQ(expected_tab_count, tabs->count()); 62 EXPECT_EQ(expected_tab_count, tabs->count());
58 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) { 63 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) {
59 EXPECT_EQ(GURL(kStartupURLs[i]), 64 EXPECT_EQ(GURL(kStartupURLs[i]),
60 tabs->GetWebContentsAt(i)->GetVisibleURL()); 65 tabs->GetWebContentsAt(i)->GetVisibleURL());
61 } 66 }
62 } 67 }
63 68
69 INSTANTIATE_TEST_CASE_P(UserCloudPolicyManagerTestSuite,
70 UserCloudPolicyManagerTest,
71 testing::Bool());
72
64 } // namespace policy 73 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/force_maximize_on_first_run_chromeos_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698