diff options
author | joedow <joedow@chromium.org> | 2015-09-22 15:21:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-22 22:21:40 +0000 |
commit | f8b92398a67600e4facd96ce2f20421374debba6 (patch) | |
tree | dd71a4fda718570710a3ae41650c77a14e90be6b | |
parent | f9eebe001b84f3aafe039eb45b73629162d4582c (diff) | |
download | chromium_src-f8b92398a67600e4facd96ce2f20421374debba6.zip chromium_src-f8b92398a67600e4facd96ce2f20421374debba6.tar.gz chromium_src-f8b92398a67600e4facd96ce2f20421374debba6.tar.bz2 |
Removing Test and Staging environments from App Remoting Test Driver tool.
Since these environments are no longer present, I am removing them from
the test tool to prevent anyone from attempting to target them.
BUG=
Review URL: https://codereview.chromium.org/1357973002
Cr-Commit-Position: refs/heads/master@{#350256}
-rw-r--r-- | remoting/test/app_remoting_report_issue_request_unittest.cc | 60 | ||||
-rw-r--r-- | remoting/test/app_remoting_service_urls.cc | 26 | ||||
-rw-r--r-- | remoting/test/app_remoting_service_urls.h | 2 | ||||
-rw-r--r-- | remoting/test/app_remoting_test_driver.cc | 23 | ||||
-rw-r--r-- | remoting/test/remote_host_info_fetcher_unittest.cc | 91 | ||||
-rw-r--r-- | testing/chromoting/app_remoting_integration_tests.isolate | 1 |
6 files changed, 32 insertions, 171 deletions
diff --git a/remoting/test/app_remoting_report_issue_request_unittest.cc b/remoting/test/app_remoting_report_issue_request_unittest.cc index 8a26322..245988b 100644 --- a/remoting/test/app_remoting_report_issue_request_unittest.cc +++ b/remoting/test/app_remoting_report_issue_request_unittest.cc @@ -43,8 +43,6 @@ class AppRemotingReportIssueRequestTest : public ::testing::Test { // Used for result verification. std::string dev_service_environment_url_; - std::string test_service_environment_url_; - std::string staging_service_environment_url_; scoped_ptr<base::RunLoop> run_loop_; scoped_ptr<base::Timer> timer_; @@ -73,16 +71,6 @@ void AppRemotingReportIssueRequestTest::SetUp() { GetReportIssueUrl(kTestApplicationId, kTestHostId, kDeveloperEnvironment); SetFakeResponse(GURL(dev_service_environment_url_), kReportIssueResponse, net::HTTP_NOT_FOUND, net::URLRequestStatus::FAILED); - - test_service_environment_url_ = - GetReportIssueUrl(kTestApplicationId, kTestHostId, kTestingEnvironment); - SetFakeResponse(GURL(test_service_environment_url_), kReportIssueResponse, - net::HTTP_NOT_FOUND, net::URLRequestStatus::FAILED); - - staging_service_environment_url_ = - GetReportIssueUrl(kTestApplicationId, kTestHostId, kStagingEnvironment); - SetFakeResponse(GURL(staging_service_environment_url_), kReportIssueResponse, - net::HTTP_NOT_FOUND, net::URLRequestStatus::FAILED); } void AppRemotingReportIssueRequestTest::SetFakeResponse( @@ -112,44 +100,6 @@ TEST_F(AppRemotingReportIssueRequestTest, ReportIssueFromDev) { timer_->Stop(); } -TEST_F(AppRemotingReportIssueRequestTest, ReportIssueFromTest) { - SetFakeResponse(GURL(test_service_environment_url_), kReportIssueResponse, - net::HTTP_OK, net::URLRequestStatus::SUCCESS); - - timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(1), - run_loop_->QuitClosure()); - - bool request_started = app_remoting_report_issue_request_.Start( - kTestApplicationId, kTestHostId, kAccessTokenValue, kTestingEnvironment, - true, run_loop_->QuitClosure()); - EXPECT_TRUE(request_started); - - run_loop_->Run(); - - // Verify we stopped because of the request completing and not the timer. - EXPECT_TRUE(timer_->IsRunning()); - timer_->Stop(); -} - -TEST_F(AppRemotingReportIssueRequestTest, ReportIssueFromStaging) { - SetFakeResponse(GURL(staging_service_environment_url_), kReportIssueResponse, - net::HTTP_OK, net::URLRequestStatus::SUCCESS); - - timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(1), - run_loop_->QuitClosure()); - - bool request_started = app_remoting_report_issue_request_.Start( - kTestApplicationId, kTestHostId, kAccessTokenValue, kStagingEnvironment, - true, run_loop_->QuitClosure()); - EXPECT_TRUE(request_started); - - run_loop_->Run(); - - // Verify we stopped because of the request completing and not the timer. - EXPECT_TRUE(timer_->IsRunning()); - timer_->Stop(); -} - TEST_F(AppRemotingReportIssueRequestTest, ReportIssueFromInvalidEnvironment) { bool request_started = app_remoting_report_issue_request_.Start( kTestApplicationId, kTestHostId, kAccessTokenValue, kUnknownEnvironment, @@ -163,7 +113,7 @@ TEST_F(AppRemotingReportIssueRequestTest, ReportIssueNetworkError) { run_loop_->QuitClosure()); bool request_started = app_remoting_report_issue_request_.Start( - kTestApplicationId, kTestHostId, kAccessTokenValue, kStagingEnvironment, + kTestApplicationId, kTestHostId, kAccessTokenValue, kDeveloperEnvironment, true, run_loop_->QuitClosure()); EXPECT_TRUE(request_started); @@ -175,14 +125,14 @@ TEST_F(AppRemotingReportIssueRequestTest, ReportIssueNetworkError) { } TEST_F(AppRemotingReportIssueRequestTest, MultipleRequestsCanBeIssued) { - SetFakeResponse(GURL(staging_service_environment_url_), kReportIssueResponse, + SetFakeResponse(GURL(dev_service_environment_url_), kReportIssueResponse, net::HTTP_OK, net::URLRequestStatus::SUCCESS); timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(1), run_loop_->QuitClosure()); bool request_started = app_remoting_report_issue_request_.Start( - kTestApplicationId, kTestHostId, kAccessTokenValue, kStagingEnvironment, + kTestApplicationId, kTestHostId, kAccessTokenValue, kDeveloperEnvironment, true, run_loop_->QuitClosure()); EXPECT_TRUE(request_started); @@ -197,7 +147,7 @@ TEST_F(AppRemotingReportIssueRequestTest, MultipleRequestsCanBeIssued) { run_loop_->QuitClosure()); request_started = app_remoting_report_issue_request_.Start( - kTestApplicationId, kTestHostId, kAccessTokenValue, kStagingEnvironment, + kTestApplicationId, kTestHostId, kAccessTokenValue, kDeveloperEnvironment, true, run_loop_->QuitClosure()); EXPECT_TRUE(request_started); @@ -212,7 +162,7 @@ TEST_F(AppRemotingReportIssueRequestTest, MultipleRequestsCanBeIssued) { run_loop_->QuitClosure()); request_started = app_remoting_report_issue_request_.Start( - kTestApplicationId, kTestHostId, kAccessTokenValue, kStagingEnvironment, + kTestApplicationId, kTestHostId, kAccessTokenValue, kDeveloperEnvironment, true, run_loop_->QuitClosure()); EXPECT_TRUE(request_started); diff --git a/remoting/test/app_remoting_service_urls.cc b/remoting/test/app_remoting_service_urls.cc index 87432a6..a787cfa 100644 --- a/remoting/test/app_remoting_service_urls.cc +++ b/remoting/test/app_remoting_service_urls.cc @@ -13,8 +13,6 @@ namespace { const char kAppRemotingTestEndpointBase[] = "https://www-googleapis-test.sandbox.google.com/appremoting/%s"; const char kAppRemotingDevEndpointQualifier[] = "v1beta1_dev"; -const char kAppRemotingTestEndpointQualifier[] = "v1beta1"; -const char kAppRemotingStagingEndpointQualifier[] = "v1beta1_staging"; // Placeholder value is for the Application ID. const char kRunApplicationApi[] = "applications/%s/run"; @@ -35,27 +33,9 @@ bool IsSupportedServiceEnvironment(ServiceEnvironment service_environment) { std::string GetBaseUrl(ServiceEnvironment service_environment) { std::string base_service_url; - const char* environment_qualifier = nullptr; - switch (service_environment) { - case kDeveloperEnvironment: - environment_qualifier = kAppRemotingDevEndpointQualifier; - break; - - case kTestingEnvironment: - environment_qualifier = kAppRemotingTestEndpointQualifier; - break; - - case kStagingEnvironment: - environment_qualifier = kAppRemotingStagingEndpointQualifier; - break; - - default: - NOTREACHED(); - } - - if (environment_qualifier) { - base_service_url = - base::StringPrintf(kAppRemotingTestEndpointBase, environment_qualifier); + if (service_environment == kDeveloperEnvironment) { + base_service_url = base::StringPrintf(kAppRemotingTestEndpointBase, + kAppRemotingDevEndpointQualifier); } return base_service_url; diff --git a/remoting/test/app_remoting_service_urls.h b/remoting/test/app_remoting_service_urls.h index e532fc6..7d1226b 100644 --- a/remoting/test/app_remoting_service_urls.h +++ b/remoting/test/app_remoting_service_urls.h @@ -15,8 +15,6 @@ namespace test { // the last entry is used for bounds checking. enum ServiceEnvironment { kDeveloperEnvironment, - kTestingEnvironment, - kStagingEnvironment, kUnknownEnvironment }; diff --git a/remoting/test/app_remoting_test_driver.cc b/remoting/test/app_remoting_test_driver.cc index 3d8604e..577ea63 100644 --- a/remoting/test/app_remoting_test_driver.cc +++ b/remoting/test/app_remoting_test_driver.cc @@ -23,7 +23,6 @@ const char kHelpSwitchName[] = "help"; const char kLoggingLevelSwitchName[] = "verbosity"; const char kRefreshTokenFileSwitchName[] = "refresh-token-file"; const char kReleaseHostsAfterTestingSwitchName[] = "release-hosts-after-tests"; -const char kServiceEnvironmentSwitchName[] = "environment"; const char kShowHostAvailabilitySwitchName[] = "show-host-availability"; const char kSingleProcessTestsSwitchName[] = "single-process-tests"; const char kUserNameSwitchName[] = "username"; @@ -75,8 +74,6 @@ void PrintUsage() { switches::kRefreshTokenFileSwitchName); printf(" %s: Displays additional usage information\n", switches::kHelpSwitchName); - printf(" %s: Specifies the service api to use (dev|test) [default: dev]\n", - switches::kServiceEnvironmentSwitchName); printf( " %s: Retrieves and displays the connection status for all known " "hosts, no tests will be run\n", @@ -226,26 +223,8 @@ int main(int argc, char** argv) { options.release_hosts_when_done = command_line->HasSwitch(switches::kReleaseHostsAfterTestingSwitchName); - // If the user passed in a service environment, use it, otherwise set a - // default value. - std::string service_environment_switch(command_line->GetSwitchValueASCII( - switches::kServiceEnvironmentSwitchName)); - if (service_environment_switch.empty() || - service_environment_switch == "dev") { - options.service_environment = + options.service_environment = remoting::test::ServiceEnvironment::kDeveloperEnvironment; - } else if (service_environment_switch == "test") { - options.service_environment = - remoting::test::ServiceEnvironment::kTestingEnvironment; - } else if (service_environment_switch == "staging") { - options.service_environment = - remoting::test::ServiceEnvironment::kStagingEnvironment; - } else { - LOG(ERROR) << "Invalid " << switches::kServiceEnvironmentSwitchName - << " argument passed in."; - PrintUsage(); - return -1; - } // Update the logging verbosity level is user specified one. std::string verbosity_level( diff --git a/remoting/test/remote_host_info_fetcher_unittest.cc b/remoting/test/remote_host_info_fetcher_unittest.cc index b4dd9a7..1c5bd83 100644 --- a/remoting/test/remote_host_info_fetcher_unittest.cc +++ b/remoting/test/remote_host_info_fetcher_unittest.cc @@ -12,6 +12,7 @@ namespace { const char kTestApplicationId[] = "klasdfjlkasdfjklasjfdkljsadf"; +const char kTestApplicationId2[] = "klasdfjlkasdfjklasjfdkljsadf2"; const char kAccessTokenValue[] = "test_access_token_value"; const char kRemoteHostInfoReadyResponse[] = "{" @@ -25,6 +26,18 @@ const char kRemoteHostInfoReadyResponse[] = " \"authorizationCode\": \"test_authorization_code\"," " \"sharedSecret\": \"test_shared_secret\"" "}"; +const char kRemoteHostInfoReadyResponse2[] = + "{" + " \"status\": \"done\"," + " \"host\": {" + " \"kind\": \"test_kind\"," + " \"applicationId\": \"klasdfjlkasdfjklasjfdkljsadf2\"," + " \"hostId\": \"test_host_id\"" + " }," + " \"hostJid\": \"test_host_jid\"," + " \"authorizationCode\": \"test_authorization_code\"," + " \"sharedSecret\": \"test_shared_secret\"" + "}"; const char kRemoteHostInfoPendingResponse[] = "{" " \"status\": \"pending\"" @@ -64,8 +77,7 @@ class RemoteHostInfoFetcherTest : public ::testing::Test { RemoteHostInfo remote_host_info_; std::string dev_service_environment_url_; - std::string test_service_environment_url_; - std::string staging_service_environment_url_; + std::string dev_service_environment_url_2_; private: net::FakeURLFetcherFactory url_fetcher_factory_; @@ -92,15 +104,9 @@ void RemoteHostInfoFetcherTest::SetUp() { kRemoteHostInfoEmptyResponse, net::HTTP_NOT_FOUND, net::URLRequestStatus::FAILED); - test_service_environment_url_ = - GetRunApplicationUrl(kTestApplicationId, kTestingEnvironment); - SetFakeResponse(GURL(test_service_environment_url_), - kRemoteHostInfoEmptyResponse, net::HTTP_NOT_FOUND, - net::URLRequestStatus::FAILED); - - staging_service_environment_url_ = - GetRunApplicationUrl(kTestApplicationId, kStagingEnvironment); - SetFakeResponse(GURL(staging_service_environment_url_), + dev_service_environment_url_2_ = + GetRunApplicationUrl(kTestApplicationId2, kDeveloperEnvironment); + SetFakeResponse(GURL(dev_service_environment_url_2_), kRemoteHostInfoEmptyResponse, net::HTTP_NOT_FOUND, net::URLRequestStatus::FAILED); } @@ -139,58 +145,6 @@ TEST_F(RemoteHostInfoFetcherTest, RetrieveRemoteHostInfoFromDev) { EXPECT_TRUE(!remote_host_info_.shared_secret.empty()); } -TEST_F(RemoteHostInfoFetcherTest, RetrieveRemoteHostInfoFromTest) { - SetFakeResponse(GURL(test_service_environment_url_), - kRemoteHostInfoReadyResponse, net::HTTP_OK, - net::URLRequestStatus::SUCCESS); - - base::RunLoop run_loop; - RemoteHostInfoCallback remote_host_info_callback = - base::Bind(&RemoteHostInfoFetcherTest::OnRemoteHostInfoRetrieved, - base::Unretained(this), run_loop.QuitClosure()); - - RemoteHostInfoFetcher remote_host_info_fetcher; - bool request_started = remote_host_info_fetcher.RetrieveRemoteHostInfo( - kTestApplicationId, kAccessTokenValue, kTestingEnvironment, - remote_host_info_callback); - - run_loop.Run(); - - EXPECT_TRUE(request_started); - EXPECT_TRUE(remote_host_info_.IsReadyForConnection()); - EXPECT_EQ(remote_host_info_.application_id.compare(kTestApplicationId), 0); - EXPECT_TRUE(!remote_host_info_.host_id.empty()); - EXPECT_TRUE(!remote_host_info_.host_jid.empty()); - EXPECT_TRUE(!remote_host_info_.authorization_code.empty()); - EXPECT_TRUE(!remote_host_info_.shared_secret.empty()); -} - -TEST_F(RemoteHostInfoFetcherTest, RetrieveRemoteHostInfoFromStaging) { - SetFakeResponse(GURL(staging_service_environment_url_), - kRemoteHostInfoReadyResponse, net::HTTP_OK, - net::URLRequestStatus::SUCCESS); - - base::RunLoop run_loop; - RemoteHostInfoCallback remote_host_info_callback = - base::Bind(&RemoteHostInfoFetcherTest::OnRemoteHostInfoRetrieved, - base::Unretained(this), run_loop.QuitClosure()); - - RemoteHostInfoFetcher remote_host_info_fetcher; - bool request_started = remote_host_info_fetcher.RetrieveRemoteHostInfo( - kTestApplicationId, kAccessTokenValue, kStagingEnvironment, - remote_host_info_callback); - - run_loop.Run(); - - EXPECT_TRUE(request_started); - EXPECT_TRUE(remote_host_info_.IsReadyForConnection()); - EXPECT_EQ(remote_host_info_.application_id.compare(kTestApplicationId), 0); - EXPECT_TRUE(!remote_host_info_.host_id.empty()); - EXPECT_TRUE(!remote_host_info_.host_jid.empty()); - EXPECT_TRUE(!remote_host_info_.authorization_code.empty()); - EXPECT_TRUE(!remote_host_info_.shared_secret.empty()); -} - TEST_F(RemoteHostInfoFetcherTest, RetrieveRemoteHostInfoInvalidEnvironment) { base::RunLoop run_loop; RemoteHostInfoCallback remote_host_info_callback = @@ -314,9 +268,10 @@ TEST_F(RemoteHostInfoFetcherTest, MultipleRetrieveRemoteHostInfoRequests) { EXPECT_TRUE(!remote_host_info_.authorization_code.empty()); EXPECT_TRUE(!remote_host_info_.shared_secret.empty()); - // Next, we will fetch info from the test service environment. - SetFakeResponse(GURL(test_service_environment_url_), - kRemoteHostInfoReadyResponse, net::HTTP_OK, + // Next, we will fetch a different application info block from the dev + // service environment. + SetFakeResponse(GURL(dev_service_environment_url_2_), + kRemoteHostInfoReadyResponse2, net::HTTP_OK, net::URLRequestStatus::SUCCESS); base::RunLoop test_run_loop; @@ -329,14 +284,14 @@ TEST_F(RemoteHostInfoFetcherTest, MultipleRetrieveRemoteHostInfoRequests) { EXPECT_FALSE(remote_host_info_.IsReadyForConnection()); bool test_request_started = remote_host_info_fetcher.RetrieveRemoteHostInfo( - kTestApplicationId, kAccessTokenValue, kTestingEnvironment, + kTestApplicationId2, kAccessTokenValue, kDeveloperEnvironment, test_remote_host_info_callback); test_run_loop.Run(); EXPECT_TRUE(test_request_started); EXPECT_TRUE(remote_host_info_.IsReadyForConnection()); - EXPECT_EQ(remote_host_info_.application_id.compare(kTestApplicationId), 0); + EXPECT_EQ(remote_host_info_.application_id.compare(kTestApplicationId2), 0); EXPECT_TRUE(!remote_host_info_.host_id.empty()); EXPECT_TRUE(!remote_host_info_.host_jid.empty()); EXPECT_TRUE(!remote_host_info_.authorization_code.empty()); diff --git a/testing/chromoting/app_remoting_integration_tests.isolate b/testing/chromoting/app_remoting_integration_tests.isolate index 9dcb064..aa079ee 100644 --- a/testing/chromoting/app_remoting_integration_tests.isolate +++ b/testing/chromoting/app_remoting_integration_tests.isolate @@ -10,7 +10,6 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/ar_test_driver', '--username=appremotingtestdriver_chromium_01@lgtestuser.com', - '--environment=dev', '--refresh-token-file=../../remoting/tools/internal/refresh_tokens.json', '--show-host-availability', '--release-hosts-after-tests', |