Fix the duplicatedly commited composition text when switching IME.
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / user_cloud_policy_manager_chromeos_browsertest.cc
blobc96a4bb98d21a329b8ddca259bca6aab7ac373a7
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
3 // found in the LICENSE file.
5 #include <string>
7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
10 #include "chrome/browser/chromeos/policy/login_policy_test_base.h"
11 #include "chrome/browser/prefs/session_startup_pref.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/host_desktop.h"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "policy/policy_constants.h"
18 namespace policy {
20 class UserCloudPolicyManagerTest : public LoginPolicyTestBase {
21 protected:
22 UserCloudPolicyManagerTest() {}
24 void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override {
25 scoped_ptr<base::ListValue> list(new base::ListValue);
26 list->AppendString("chrome://policy");
27 list->AppendString("chrome://about");
29 policy->Set(key::kRestoreOnStartupURLs, list.Pass());
30 policy->SetInteger(key::kRestoreOnStartup,
31 SessionStartupPref::kPrefValueURLs);
34 private:
35 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest);
38 IN_PROC_BROWSER_TEST_F(UserCloudPolicyManagerTest, StartSession) {
39 const char* const kStartupURLs[] = {"chrome://policy", "chrome://about"};
41 SkipToLoginScreen();
42 LogIn(kAccountId, kAccountPassword);
44 // Check that the startup pages specified in policy were opened.
45 BrowserList* browser_list =
46 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
47 EXPECT_EQ(1U, browser_list->size());
48 Browser* browser = browser_list->get(0);
49 ASSERT_TRUE(browser);
51 TabStripModel* tabs = browser->tab_strip_model();
52 ASSERT_TRUE(tabs);
53 const int expected_tab_count = static_cast<int>(arraysize(kStartupURLs));
54 EXPECT_EQ(expected_tab_count, tabs->count());
55 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) {
56 EXPECT_EQ(GURL(kStartupURLs[i]),
57 tabs->GetWebContentsAt(i)->GetVisibleURL());
61 } // namespace policy