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

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

Issue 60923002: [sync] Allow FakeURLFetcher to return an arbitrary URLRequestStatus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "crypto/rsa_private_key.h" 90 #include "crypto/rsa_private_key.h"
91 #include "grit/chromium_strings.h" 91 #include "grit/chromium_strings.h"
92 #include "grit/generated_resources.h" 92 #include "grit/generated_resources.h"
93 #include "net/base/url_util.h" 93 #include "net/base/url_util.h"
94 #include "net/http/http_status_code.h" 94 #include "net/http/http_status_code.h"
95 #include "net/test/embedded_test_server/embedded_test_server.h" 95 #include "net/test/embedded_test_server/embedded_test_server.h"
96 #include "net/test/embedded_test_server/http_request.h" 96 #include "net/test/embedded_test_server/http_request.h"
97 #include "net/test/embedded_test_server/http_response.h" 97 #include "net/test/embedded_test_server/http_response.h"
98 #include "net/url_request/test_url_fetcher_factory.h" 98 #include "net/url_request/test_url_fetcher_factory.h"
99 #include "net/url_request/url_fetcher_delegate.h" 99 #include "net/url_request/url_fetcher_delegate.h"
100 #include "net/url_request/url_request_status.h"
100 #include "policy/policy_constants.h" 101 #include "policy/policy_constants.h"
101 #include "testing/gmock/include/gmock/gmock.h" 102 #include "testing/gmock/include/gmock/gmock.h"
102 #include "third_party/cros_system_api/dbus/service_constants.h" 103 #include "third_party/cros_system_api/dbus/service_constants.h"
103 #include "ui/base/l10n/l10n_util.h" 104 #include "ui/base/l10n/l10n_util.h"
104 #include "url/gurl.h" 105 #include "url/gurl.h"
105 106
106 namespace em = enterprise_management; 107 namespace em = enterprise_management;
107 108
108 using testing::InvokeWithoutArgs; 109 using testing::InvokeWithoutArgs;
109 using testing::Return; 110 using testing::Return;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 // Start serving external data at |kExternalDataURL|. 831 // Start serving external data at |kExternalDataURL|.
831 scoped_ptr<base::RunLoop> run_loop(new base::RunLoop); 832 scoped_ptr<base::RunLoop> run_loop(new base::RunLoop);
832 scoped_ptr<net::FakeURLFetcherFactory> fetcher_factory( 833 scoped_ptr<net::FakeURLFetcherFactory> fetcher_factory(
833 new net::FakeURLFetcherFactory( 834 new net::FakeURLFetcherFactory(
834 NULL, 835 NULL,
835 base::Bind(&RunCallbackAndReturnFakeURLFetcher, 836 base::Bind(&RunCallbackAndReturnFakeURLFetcher,
836 base::MessageLoopProxy::current(), 837 base::MessageLoopProxy::current(),
837 run_loop->QuitClosure()))); 838 run_loop->QuitClosure())));
838 fetcher_factory->SetFakeResponse(GURL(kExternalDataURL), 839 fetcher_factory->SetFakeResponse(GURL(kExternalDataURL),
839 kExternalData, 840 kExternalData,
840 net::HTTP_OK); 841 net::HTTP_OK,
842 net::URLRequestStatus::SUCCESS);
841 843
842 // TODO(bartfab): The test injects an ExternalDataFetcher for an arbitrary 844 // TODO(bartfab): The test injects an ExternalDataFetcher for an arbitrary
843 // policy. This is only done because there are no policies that reference 845 // policy. This is only done because there are no policies that reference
844 // external data yet. Once the first such policy is added, switch the test to 846 // external data yet. Once the first such policy is added, switch the test to
845 // that policy and stop injecting a manually instantiated ExternalDataFetcher. 847 // that policy and stop injecting a manually instantiated ExternalDataFetcher.
846 test::SetExternalDataReference(broker->core(), 848 test::SetExternalDataReference(broker->core(),
847 key::kHomepageLocation, 849 key::kHomepageLocation,
848 make_scoped_ptr(metadata->DeepCopy())); 850 make_scoped_ptr(metadata->DeepCopy()));
849 851
850 // The external data should be fetched and cached automatically. Wait for this 852 // The external data should be fetched and cached automatically. Wait for this
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 if (!IsSessionStarted()) { 1083 if (!IsSessionStarted()) {
1082 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, 1084 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED,
1083 base::Bind(IsSessionStarted)).Wait(); 1085 base::Bind(IsSessionStarted)).Wait();
1084 } 1086 }
1085 } 1087 }
1086 1088
1087 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, 1089 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance,
1088 TermsOfServiceTest, testing::Bool()); 1090 TermsOfServiceTest, testing::Bool());
1089 1091
1090 } // namespace policy 1092 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698