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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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/rand_util.h" 5 #include "base/rand_util.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/policy/profile_policy_connector_factory.h" 8 #include "chrome/browser/policy/profile_policy_connector_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
11 #include "chrome/browser/sync/test/integration/passwords_helper.h" 11 #include "chrome/browser/sync/test/integration/passwords_helper.h"
12 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 12 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
13 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 13 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
14 #include "chrome/browser/sync/test/integration/sync_test.h" 14 #include "chrome/browser/sync/test/integration/sync_test.h"
15 #include "components/bookmarks/browser/bookmark_node.h" 15 #include "components/bookmarks/browser/bookmark_node.h"
16 #include "components/policy/core/common/mock_configuration_policy_provider.h" 16 #include "components/policy/core/common/mock_configuration_policy_provider.h"
17 #include "components/policy/core/common/policy_map.h" 17 #include "components/policy/core/common/policy_map.h"
18 #include "components/policy/core/common/policy_types.h"
19 #include "policy/policy_constants.h" 18 #include "policy/policy_constants.h"
20 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 19 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
21 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
22 #include "ui/base/layout.h" 21 #include "ui/base/layout.h"
23 22
24 using bookmarks::BookmarkNode; 23 using bookmarks::BookmarkNode;
25 using bookmarks_helper::AddFolder; 24 using bookmarks_helper::AddFolder;
26 using bookmarks_helper::AddURL; 25 using bookmarks_helper::AddURL;
27 using bookmarks_helper::AllModelsMatch; 26 using bookmarks_helper::AllModelsMatch;
28 using bookmarks_helper::AllModelsMatchVerifier; 27 using bookmarks_helper::AllModelsMatchVerifier;
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 // Set the ManagedBookmarks policy for the first Profile, 2196 // Set the ManagedBookmarks policy for the first Profile,
2198 // which will add one new managed bookmark. 2197 // which will add one new managed bookmark.
2199 base::DictionaryValue* bookmark = new base::DictionaryValue(); 2198 base::DictionaryValue* bookmark = new base::DictionaryValue();
2200 bookmark->SetString("name", "Managed bookmark"); 2199 bookmark->SetString("name", "Managed bookmark");
2201 bookmark->SetString("url", "youtube.com"); 2200 bookmark->SetString("url", "youtube.com");
2202 base::ListValue* list = new base::ListValue(); 2201 base::ListValue* list = new base::ListValue();
2203 list->Append(bookmark); 2202 list->Append(bookmark);
2204 policy::PolicyMap policy; 2203 policy::PolicyMap policy;
2205 policy.Set(policy::key::kManagedBookmarks, 2204 policy.Set(policy::key::kManagedBookmarks,
2206 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 2205 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
2207 policy::POLICY_SOURCE_CLOUD, list, nullptr); 2206 list, NULL);
2208 policy_provider_.UpdateChromePolicy(policy); 2207 policy_provider_.UpdateChromePolicy(policy);
2209 base::RunLoop().RunUntilIdle(); 2208 base::RunLoop().RunUntilIdle();
2210 2209
2211 // Now add another user bookmark and wait for it to sync. 2210 // Now add another user bookmark and wait for it to sync.
2212 ASSERT_TRUE(AddURL(0, "Google 2", google_url) != NULL); 2211 ASSERT_TRUE(AddURL(0, "Google 2", google_url) != NULL);
2213 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 2212 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
2214 ASSERT_TRUE(AllModelsMatchVerifier()); 2213 ASSERT_TRUE(AllModelsMatchVerifier());
2215 2214
2216 EXPECT_FALSE(GetSyncService(0)->HasUnrecoverableError()); 2215 EXPECT_FALSE(GetSyncService(0)->HasUnrecoverableError());
2217 EXPECT_FALSE(GetSyncService(1)->HasUnrecoverableError()); 2216 EXPECT_FALSE(GetSyncService(1)->HasUnrecoverableError());
2218 2217
2219 // Verify that the managed bookmark exists in the local model of the first 2218 // Verify that the managed bookmark exists in the local model of the first
2220 // Profile, and has a child node. 2219 // Profile, and has a child node.
2221 ASSERT_EQ(1, managed_node0->child_count()); 2220 ASSERT_EQ(1, managed_node0->child_count());
2222 ASSERT_TRUE(managed_node0->IsVisible()); 2221 ASSERT_TRUE(managed_node0->IsVisible());
2223 EXPECT_EQ(GURL("http://youtube.com/"), managed_node0->GetChild(0)->url()); 2222 EXPECT_EQ(GURL("http://youtube.com/"), managed_node0->GetChild(0)->url());
2224 2223
2225 // Verify that the second Profile didn't get this node. 2224 // Verify that the second Profile didn't get this node.
2226 ASSERT_EQ(0, managed_node1->child_count()); 2225 ASSERT_EQ(0, managed_node1->child_count());
2227 } 2226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698