OLD | NEW |
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 // Unit tests for implementation of google_api_keys namespace. | 5 // Unit tests for implementation of google_api_keys namespace. |
6 // | 6 // |
7 // Because the file deals with a lot of preprocessor defines and | 7 // Because the file deals with a lot of preprocessor defines and |
8 // optionally includes an internal header, the way we test is by | 8 // optionally includes an internal header, the way we test is by |
9 // including the .cc file multiple times with different defines set. | 9 // including the .cc file multiple times with different defines set. |
10 // This is a little unorthodox, but it lets us test the behavior as | 10 // This is a little unorthodox, but it lets us test the behavior as |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 EXPECT_EQ("ID_MAIN", id_main); | 387 EXPECT_EQ("ID_MAIN", id_main); |
388 EXPECT_EQ("SECRET_MAIN", secret_main); | 388 EXPECT_EQ("SECRET_MAIN", secret_main); |
389 EXPECT_EQ("ID_CLOUD_PRINT", id_cloud_print); | 389 EXPECT_EQ("ID_CLOUD_PRINT", id_cloud_print); |
390 EXPECT_EQ("SECRET_CLOUD_PRINT", secret_cloud_print); | 390 EXPECT_EQ("SECRET_CLOUD_PRINT", secret_cloud_print); |
391 EXPECT_EQ("ID_REMOTING", id_remoting); | 391 EXPECT_EQ("ID_REMOTING", id_remoting); |
392 EXPECT_EQ("SECRET_REMOTING", secret_remoting); | 392 EXPECT_EQ("SECRET_REMOTING", secret_remoting); |
393 EXPECT_EQ("ID_REMOTING_HOST", id_remoting_host); | 393 EXPECT_EQ("ID_REMOTING_HOST", id_remoting_host); |
394 EXPECT_EQ("SECRET_REMOTING_HOST", secret_remoting_host); | 394 EXPECT_EQ("SECRET_REMOTING_HOST", secret_remoting_host); |
395 } | 395 } |
396 | 396 |
| 397 #if !defined(GOOGLE_CHROME_BUILD) |
| 398 |
397 // Override all keys using both preprocessor defines and environment | 399 // Override all keys using both preprocessor defines and environment |
398 // variables. The environment variables should win. | 400 // variables. The environment variables should win. |
399 namespace override_all_keys_env { | 401 namespace override_all_keys_env { |
400 | 402 |
401 // We start every test by creating a clean environment for the | 403 // We start every test by creating a clean environment for the |
402 // preprocessor defines used in google_api_keys.cc | 404 // preprocessor defines used in google_api_keys.cc |
403 #undef DUMMY_API_TOKEN | 405 #undef DUMMY_API_TOKEN |
404 #undef GOOGLE_API_KEY | 406 #undef GOOGLE_API_KEY |
405 #undef GOOGLE_CLIENT_ID_MAIN | 407 #undef GOOGLE_CLIENT_ID_MAIN |
406 #undef GOOGLE_CLIENT_SECRET_MAIN | 408 #undef GOOGLE_CLIENT_SECRET_MAIN |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 EXPECT_EQ("env-ID_MAIN", id_main); | 476 EXPECT_EQ("env-ID_MAIN", id_main); |
475 EXPECT_EQ("env-SECRET_MAIN", secret_main); | 477 EXPECT_EQ("env-SECRET_MAIN", secret_main); |
476 EXPECT_EQ("env-ID_CLOUD_PRINT", id_cloud_print); | 478 EXPECT_EQ("env-ID_CLOUD_PRINT", id_cloud_print); |
477 EXPECT_EQ("env-SECRET_CLOUD_PRINT", secret_cloud_print); | 479 EXPECT_EQ("env-SECRET_CLOUD_PRINT", secret_cloud_print); |
478 EXPECT_EQ("env-ID_REMOTING", id_remoting); | 480 EXPECT_EQ("env-ID_REMOTING", id_remoting); |
479 EXPECT_EQ("env-SECRET_REMOTING", secret_remoting); | 481 EXPECT_EQ("env-SECRET_REMOTING", secret_remoting); |
480 EXPECT_EQ("env-ID_REMOTING_HOST", id_remoting_host); | 482 EXPECT_EQ("env-ID_REMOTING_HOST", id_remoting_host); |
481 EXPECT_EQ("env-SECRET_REMOTING_HOST", secret_remoting_host); | 483 EXPECT_EQ("env-SECRET_REMOTING_HOST", secret_remoting_host); |
482 } | 484 } |
483 | 485 |
| 486 #endif // !defined(GOOGLE_CHROME_BUILD) |
| 487 |
484 #if defined(OS_IOS) | 488 #if defined(OS_IOS) |
485 // Override all keys using both preprocessor defines and setters. | 489 // Override all keys using both preprocessor defines and setters. |
486 // Setters should win. | 490 // Setters should win. |
487 namespace override_all_keys_setters { | 491 namespace override_all_keys_setters { |
488 | 492 |
489 // We start every test by creating a clean environment for the | 493 // We start every test by creating a clean environment for the |
490 // preprocessor defines used in google_api_keys.cc | 494 // preprocessor defines used in google_api_keys.cc |
491 #undef DUMMY_API_TOKEN | 495 #undef DUMMY_API_TOKEN |
492 #undef GOOGLE_API_KEY | 496 #undef GOOGLE_API_KEY |
493 #undef GOOGLE_CLIENT_ID_MAIN | 497 #undef GOOGLE_CLIENT_ID_MAIN |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 testcase::GetOAuth2ClientSecret(testcase::CLIENT_REMOTING)); | 569 testcase::GetOAuth2ClientSecret(testcase::CLIENT_REMOTING)); |
566 | 570 |
567 EXPECT_EQ(id_remoting_host, | 571 EXPECT_EQ(id_remoting_host, |
568 testcase::GetOAuth2ClientID(testcase::CLIENT_REMOTING_HOST)); | 572 testcase::GetOAuth2ClientID(testcase::CLIENT_REMOTING_HOST)); |
569 EXPECT_EQ(secret_remoting_host, | 573 EXPECT_EQ(secret_remoting_host, |
570 testcase::GetOAuth2ClientSecret(testcase::CLIENT_REMOTING_HOST)); | 574 testcase::GetOAuth2ClientSecret(testcase::CLIENT_REMOTING_HOST)); |
571 } | 575 } |
572 #endif // defined(OS_IOS) | 576 #endif // defined(OS_IOS) |
573 | 577 |
574 #endif // defined(OS_LINUX) || defined(OS_MACOSX) | 578 #endif // defined(OS_LINUX) || defined(OS_MACOSX) |
OLD | NEW |